Compare commits
108 Commits
before_aut
...
before_cac
Author | SHA1 | Date | |
---|---|---|---|
205c0e0adf | |||
b8a0a2a1bb | |||
928e2ca7bc | |||
b75f59fdd8 | |||
5832197bde | |||
4f3d692726 | |||
344765d725 | |||
812b35bf8c | |||
55d6e766a4 | |||
ec836e7873 | |||
d383a66530 | |||
7d82f677f5 | |||
4b6954543e | |||
aff20e6a45 | |||
b76313bfdb | |||
b07243b9c4 | |||
8576bc0cd1 | |||
ef7f203672 | |||
2e75bee478 | |||
c50deaec33 | |||
406b297b4c | |||
70c97ea841 | |||
c2ddba5117 | |||
2edd5699af | |||
4d3428cfe3 | |||
b941ada2af | |||
cd88928614 | |||
11838b31df | |||
e6666d6c7a | |||
95d3897971 | |||
06aaebadc4 | |||
326f9f7b19 | |||
589a4f2f12 | |||
00cf457a23 | |||
2b79539c82 | |||
44719d72e5 | |||
82e2f931e7 | |||
ae9fc97ea1 | |||
d01974a95e | |||
1888e7548e | |||
ce4f26b134 | |||
2d4e3ffaf6 | |||
9de6cf1de0 | |||
7e2b1365b4 | |||
cafbf37771 | |||
f24c18bb4a | |||
db9eed56a1 | |||
8bb4298c3a | |||
945dd84829 | |||
40649c7d3c | |||
d3c0f80aaf | |||
ae46b70398 | |||
ec14ad4e99 | |||
e64af682dc | |||
7e407c1fb6 | |||
1b0dd3f54c | |||
d7322c983a | |||
8a16d6e8f9 | |||
258d83ed5b | |||
ae25bb22fc | |||
9403e7c8ac | |||
d56117cbb3 | |||
ab782fdb54 | |||
9052673b36 | |||
1e2a4c461d | |||
0885316155 | |||
19223f6f37 | |||
a7512898a7 | |||
276a203119 | |||
802aad75cb | |||
c89c9c8a86 | |||
944613b78a | |||
49776e1fbd | |||
7bf3e781bf | |||
6d68536b59 | |||
9625f3b078 | |||
59e2a2d342 | |||
ae9bf0b4fb | |||
cf8f7559f9 | |||
e14cea6bc6 | |||
1d252670b1 | |||
d2c2d7a968 | |||
79337f0840 | |||
e06d5db808 | |||
a6391a27d5 | |||
54a3755d96 | |||
76a7f87561 | |||
607bf01514 | |||
f83543a90b | |||
5eda64b90e | |||
ef0b5d52f9 | |||
c5b1209186 | |||
c3816142f7 | |||
aec671a54b | |||
21aa5ae469 | |||
90a5044fa9 | |||
47d312d79f | |||
3f604674e1 | |||
32dae42cd1 | |||
fa5f898148 | |||
33c6a16f22 | |||
60cab171f7 | |||
1f2df31aa7 | |||
bce38d13a2 | |||
935aba1f45 | |||
c41ee865e1 | |||
e88d6c7403 | |||
02471ec932 |
1
smmapdfw/AUTHORS
Normal file
1
smmapdfw/AUTHORS
Normal file
@ -0,0 +1 @@
|
||||
Wolfgang Hottgenroth <woho@hottis.de>
|
340
smmapdfw/COPYING
Normal file
340
smmapdfw/COPYING
Normal file
@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, 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 or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
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 give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
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 Program or any portion
|
||||
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
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 Program, 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 Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) 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; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, 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 executable. However, as a
|
||||
special exception, the source code 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.
|
||||
|
||||
If distribution of executable or 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 counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program 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.
|
||||
|
||||
5. 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 Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program 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 to
|
||||
this License.
|
||||
|
||||
7. 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 Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program 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 Program.
|
||||
|
||||
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.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program 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.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 Program
|
||||
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 Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, 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
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), 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 Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
1
smmapdfw/ChangeLog
Normal file
1
smmapdfw/ChangeLog
Normal file
@ -0,0 +1 @@
|
||||
2004-11-09: 0.94: first public release
|
1
smmapdfw/INSTALL
Normal file
1
smmapdfw/INSTALL
Normal file
@ -0,0 +1 @@
|
||||
See doc/smmapdfw.info please.
|
@ -1,89 +0,0 @@
|
||||
PLUGINS = test_workers.so verify_worker.so cyrus_worker.so lua_worker.so
|
||||
PREFIX ?= /opt/smmapdfw
|
||||
OWNER = mail
|
||||
GROUP = mail
|
||||
|
||||
COMMON_CFLAGS = -g -I./include
|
||||
COMMON_LDFLAGS = -g
|
||||
OS = $(shell uname)
|
||||
RELEASE_ID = $(shell ./extract_release_id)
|
||||
|
||||
|
||||
ifeq ($(OS), FreeBSD)
|
||||
BDB_INC ?= /usr/local/include/db41
|
||||
BDB_LIB ?=
|
||||
CFLAGS = $(COMMON_CFLAGS) -DFREEBSD -D_THREAD_SAFE -I$(BDB_INC)
|
||||
LDFLAGS = $(COMMON_LDFLAGS) -pthread
|
||||
SHARED = -shared
|
||||
endif
|
||||
|
||||
ifeq ($(OS), Linux)
|
||||
BDB_INC ?= /usr/include
|
||||
BDB_LIB ?= /usr/lib/libdb.a
|
||||
LUA_INC ?= /usr/include/lua50
|
||||
LUA_LIB ?= /usr/lib/liblualib50.a /usr/lib/liblua50.a
|
||||
CFLAGS = $(COMMON_CFLAGS) -DLINUX -I$(BDB_INC) -I$(LUA_INC)
|
||||
LDFLAGS = $(COMMON_LDFLAGS) -lresolv -pthread -ldl -lm
|
||||
SHARED = -shared
|
||||
endif
|
||||
|
||||
ifeq ($(OS), SunOS)
|
||||
BDB_INC ?= /prod/BrklyDB4/current/include
|
||||
BDB_LIB ?= /prod/BrklyDB4/current/lib/libdb.a
|
||||
CFLAGS = $(COMMON_CFLAGS) -DSUNOS -D_REENTRANT -I$(BDB_INC)
|
||||
LDFLAGS = $(COMMON_LDFLAGS) -lresolv -lpthread -ldl -lsocket -lnsl
|
||||
SHARED = -G
|
||||
endif
|
||||
|
||||
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
INSTALL = install
|
||||
|
||||
all: smmapd $(PLUGINS)
|
||||
|
||||
smmapd: smmapd.o containers.o config.o libsmmapdfw.a
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
test_workers.so: test_workers.o libsmmapdfw.a
|
||||
$(CC) $(LDFLAGS) $(SHARED) -o $@ $^
|
||||
|
||||
verify_worker.so: verify_worker.o libsmmapdfw.a $(BDB_LIB)
|
||||
$(CC) $(LDFLAGS) $(SHARED) -o $@ $^
|
||||
|
||||
cyrus_worker.so: cyrus_worker.o libsmmapdfw.a
|
||||
$(CC) $(LDFLAGS) $(SHARED) -o $@ $^
|
||||
|
||||
lua_worker.so: lua_worker.o libsmmapdfw.a $(LUA_LIB)
|
||||
$(CC) $(LDFLAGS) $(SHARED) -o $@ $^
|
||||
|
||||
libsmmapdfw.a: config_public.o dns.o queue.o smtp.o count.o safe_write.o
|
||||
$(AR) r $@ $^
|
||||
|
||||
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -g $(GROUP) -o $(OWNER) -m 0755 $(PREFIX) $(PREFIX)/bin $(PREFIX)/lib $(PREFIX)/include $(PREFIX)/etc $(PREFIX)/doc
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 0644 include/*.h $(PREFIX)/include
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 0644 etc/smmapd.ini $(PREFIX)/etc
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 0755 smmapd $(PREFIX)/bin
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 0644 $(PLUGINS) $(PREFIX)/lib
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 0644 libsmmapdfw.a $(PREFIX)/lib
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 0644 doc/README $(PREFIX)/doc
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.so *.a smmapd
|
||||
|
||||
distclean: clean
|
||||
-rm -r smmapd-$(RELEASE_ID)
|
||||
-rm smmapd-$(RELEASE_ID).tar.gz
|
||||
|
||||
tar:
|
||||
mkdir smmapd-$(RELEASE_ID) && \
|
||||
cp *.c *.h *.m4 smmapd.ini Makefile README smmapd-$(RELEASE_ID) && \
|
||||
chmod u+w smmapd-$(RELEASE_ID)/* && \
|
||||
tar -czf smmapd-$(RELEASE_ID).tar.gz smmapd-$(RELEASE_ID)
|
||||
|
||||
|
3
smmapdfw/Makefile.am
Normal file
3
smmapdfw/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
SUBDIRS = libsmmapdfw smmapd verify_worker test_worker cyrus_worker doc m4 mib
|
||||
|
||||
|
379
smmapdfw/Makefile.in
Normal file
379
smmapdfw/Makefile.in
Normal file
@ -0,0 +1,379 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
SUBDIRS = libsmmapdfw smmapd verify_worker test_worker cyrus_worker doc m4 mib
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
|
||||
Makefile.am Makefile.in NEWS aclocal.m4 config.guess config.h.in \
|
||||
config.sub configure configure.ac install-sh ltmain.sh missing \
|
||||
mkinstalldirs
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
# 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.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
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) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" != "." || dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && 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) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP))
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(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
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-recursive
|
||||
dvi-am:
|
||||
dvi: dvi-recursive
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am:
|
||||
install-exec: install-exec-recursive
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am:
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile config.h
|
||||
all-redirect: all-recursive-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
|
||||
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
install-data-recursive uninstall-data-recursive install-exec-recursive \
|
||||
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
|
||||
all-recursive check-recursive installcheck-recursive info-recursive \
|
||||
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
|
||||
install-exec-am install-exec install-data-am install-data install-am \
|
||||
install uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
0
smmapdfw/NEWS
Normal file
0
smmapdfw/NEWS
Normal file
1
smmapdfw/README
Normal file
1
smmapdfw/README
Normal file
@ -0,0 +1 @@
|
||||
See doc/smmapd.info please.
|
6927
smmapdfw/aclocal.m4
vendored
Normal file
6927
smmapdfw/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1441
smmapdfw/config.guess
vendored
Executable file
1441
smmapdfw/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
181
smmapdfw/config.h.in
Normal file
181
smmapdfw/config.h.in
Normal file
@ -0,0 +1,181 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* enable cache */
|
||||
#undef ENABLE_CACHE
|
||||
|
||||
/* enable Net-SNMP */
|
||||
#undef ENABLE_NETSNMP
|
||||
|
||||
/* enable stats */
|
||||
#undef ENABLE_STATS
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#undef HAVE_ARPA_INET_H
|
||||
|
||||
/* Define to 1 if you have the <db.h> header file. */
|
||||
#undef HAVE_DB_H
|
||||
|
||||
/* Define to 1 if you have the `dlerror' function. */
|
||||
#undef HAVE_DLERROR
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define to 1 if you have the `dlsym' function. */
|
||||
#undef HAVE_DLSYM
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `inet_ntoa' function. */
|
||||
#undef HAVE_INET_NTOA
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `djbdns' library (-ldjbdns). */
|
||||
#undef HAVE_LIBDJBDNS
|
||||
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `nsl' library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define to 1 if you have the `resolv' library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if the system has the type `socklen_t'. */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* 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 `strchr' function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* 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 the `strrchr' function. */
|
||||
#undef HAVE_STRRCHR
|
||||
|
||||
/* Define to 1 if you have the `strtol' function. */
|
||||
#undef HAVE_STRTOL
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#undef HAVE_SYSLOG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* 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 <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#undef HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#undef HAVE_WORKING_VFORK
|
||||
|
||||
/* 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 the type of arg 1 for `select'. */
|
||||
#undef SELECT_TYPE_ARG1
|
||||
|
||||
/* Define to the type of args 2, 3 and 4 for `select'. */
|
||||
#undef SELECT_TYPE_ARG234
|
||||
|
||||
/* Define to the type of arg 5 for `select'. */
|
||||
#undef SELECT_TYPE_ARG5
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
#undef vfork
|
1552
smmapdfw/config.sub
vendored
Executable file
1552
smmapdfw/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
|
||||
char *findcfgl(config_item_t *cfg, char *name) {
|
||||
config_item_t *ci;
|
||||
|
||||
for (ci = cfg; ci != NULL; ci = ci->next)
|
||||
if (0 == strcmp(name, ci->name))
|
||||
return ci->value;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *findcfglx(config_item_t *cfg, char *name, char *default_value) {
|
||||
char *r = findcfgl(cfg, name);
|
||||
return (NULL != r) ? r : default_value;
|
||||
}
|
||||
|
22747
smmapdfw/configure
vendored
Executable file
22747
smmapdfw/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
282
smmapdfw/configure.ac
Normal file
282
smmapdfw/configure.ac
Normal file
@ -0,0 +1,282 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
|
||||
AC_INIT(smmapdfw, 0.96, woho@hottis.de)
|
||||
AM_INIT_AUTOMAKE(smmapdfw, 0.96)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_LANG_C
|
||||
|
||||
AC_ARG_WITH(bdb-lib-dir,
|
||||
[AC_HELP_STRING(--with-bdb-lib-dir, [
|
||||
Directory for Berkeley DB library files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
if test "x$ENABLE_CACHE" = "x1"; then
|
||||
AC_MSG_ERROR(Need bdb-lib-dir)
|
||||
fi
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L$withval -R$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(bdb-inc-dir,
|
||||
[AC_HELP_STRING(--with-bdb-inc-dir, [
|
||||
Directory for Berkeley include files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
if test "x$ENABLE_CACHE" = "x1"; then
|
||||
AC_MSG_ERROR(Need bdb-inc-dir)
|
||||
fi
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
WITHOUT_DJBDNS=0
|
||||
AC_ARG_WITH(djbdns-lib-dir,
|
||||
[AC_HELP_STRING(--with-djbdns-lib-dir, [
|
||||
Directory for Bernstein's djbdns library files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
WITHOUT_DJBDNS=1
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L$withval -R$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(djbdns-inc-dir,
|
||||
[AC_HELP_STRING(--with-djbdns-inc-dir, [
|
||||
Directory for Bernstein's djbdns include files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
WITHOUT_DJBDNS=1
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
|
||||
|
||||
WITHOUT_NETSNMP=1
|
||||
AC_ARG_WITH(netsnmp,
|
||||
[AC_HELP_STRING(--with-netsnmp, [
|
||||
With Net-SNMP])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
WITHOUT_NETSNMP=1
|
||||
;;
|
||||
*)
|
||||
WITHOUT_NETSNMP=0
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
|
||||
AC_ARG_WITH(netsnmp-lib-dir,
|
||||
[AC_HELP_STRING(--with-netsnmp-lib-dir, [
|
||||
Directory for Net-SNMP library files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L$withval -R$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(netsnmp-inc-dir,
|
||||
[AC_HELP_STRING(--with-netsnmp-inc-dir, [
|
||||
Directory for Net-SNMP include files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
NETSNMP_BINDIR=""
|
||||
AC_ARG_WITH(netsnmp-bin-dir,
|
||||
[AC_HELP_STRING(--with-netsnmp-bin-dir, [
|
||||
Directory for Net-SNMP bin files, specifically net-snmp-config])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
NETSNMP_BINDIR="$withval/"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
|
||||
ENABLE_CACHE=1
|
||||
dnl AC_ARG_ENABLE(verify-cache,
|
||||
dnl [AC_HELP_STRING(--enable-verify-cache, [
|
||||
dnl Enables the cache in the verify worker.
|
||||
dnl Required a dbm implemenation.
|
||||
dnl (default=yes)])],
|
||||
dnl if test "x$enableval" = xyes; then ENABLE_VERIFY_CACHE=1; fi
|
||||
dnl if test "x$enableval" = xno; then ENABLE_VERIFY_CACHE=0; fi
|
||||
dnl )
|
||||
|
||||
dnl verify_BUILD=
|
||||
dnl AC_ARG_ENABLE(verify-worker,
|
||||
dnl [AC_HELP_STRING(--enable-verify-worker, [
|
||||
dnl Enables the sender address verification worker.
|
||||
dnl (default=no)])],
|
||||
dnl verify_BUILD=libverify_worker.la
|
||||
dnl )
|
||||
|
||||
dnl test_BUILD=
|
||||
dnl AC_ARG_ENABLE(test-worker,
|
||||
dnl [AC_HELP_STRING(--enable-test-worker, [
|
||||
dnl Enables the test worker (just an example).
|
||||
dnl (default=no)])],
|
||||
dnl test_BUILD=libtest_workers.la
|
||||
dnl )
|
||||
|
||||
dnl cyrus_BUILD=
|
||||
dnl AC_ARG_ENABLE(cyrus-worker,
|
||||
dnl [AC_HELP_STRING(--enable-cyrus-worker, [
|
||||
dnl Enables the cyrus mailbox checker.
|
||||
dnl (default=no)])],
|
||||
dnl cyrus_BUILD=libcyrus_worker.la
|
||||
dnl )
|
||||
|
||||
ENABLE_STATS=0
|
||||
AC_ARG_ENABLE(stats,
|
||||
[AC_HELP_STRING(--enable-stats, [
|
||||
Enables statistics collection.
|
||||
(default=no)])],
|
||||
if test "x$enableval" = xyes; then ENABLE_STATS=1; fi
|
||||
if test "x$enableval" = xno; then ENABLE_STATS=0; fi
|
||||
|
||||
)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([dl], [dlopen])
|
||||
AC_CHECK_LIB([m], [sin])
|
||||
AC_CHECK_LIB([nsl], [gethostbyname])
|
||||
AC_CHECK_LIB(pthread, pthread_create,
|
||||
[ CFLAGS="$CFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
|
||||
LIBS="$LIBS -lpthread"],
|
||||
AC_CHECK_LIB(c_r, pthread_create,
|
||||
[ CFLAGS="$CFLAGS -pthread -D_THREAD_SAFE"
|
||||
LIBS="$LIBS -lc_r"],
|
||||
[AC_MSG_ERROR([*** we can't go without threads])]
|
||||
)
|
||||
)
|
||||
|
||||
AC_CHECK_LIB([resolv], [inet_aton])
|
||||
AC_CHECK_LIB([socket], [connect])
|
||||
|
||||
if test "x$WITHOUT_DJBDNS" = "x0"; then
|
||||
AC_CHECK_LIB([djbdns], [dns_transmit_start])
|
||||
fi
|
||||
|
||||
ENABLE_NETSNMP=0
|
||||
if test "x$WITHOUT_NETSNMP" = "x0"; then
|
||||
NET_SNMP_CONFIG=$NETSNMP_BINDIR"net-snmp-config"
|
||||
NETSNMP_LIBS_1=`$NET_SNMP_CONFIG --agent-libs`
|
||||
NETSNMP_LIBS_2=`$NET_SNMP_CONFIG --libs`
|
||||
LIBS="$LIBS $NETSNMP_LIBS_1 $NETSNMP_LIBS_2"
|
||||
ENABLE_NETSNMP=1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h strings.h sys/socket.h syslog.h unistd.h dlfcn.h])
|
||||
|
||||
AC_CHECK_HEADERS([db.h],
|
||||
[],
|
||||
[AC_MSG_ERROR([*** we can't go without Berkeley DB])])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_TYPES(socklen_t)
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_FORK
|
||||
dnl AC_FUNC_MALLOC
|
||||
dnl AC_FUNC_REALLOC
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_CHECK_FUNCS([inet_ntoa memset select socket strchr strdup strerror strrchr strtol dlopen dlsym dlerror], [],
|
||||
[AC_MSG_ERROR([*** missing function, we can't go without it])])
|
||||
|
||||
|
||||
|
||||
|
||||
if test "x$ENABLE_CACHE" = "x1"; then
|
||||
AC_CHECK_LIB([db], [__db_ndbm_open],
|
||||
[ BDB_LIBS="-ldb" ],
|
||||
AC_CHECK_LIB([db], [__db_ndbm_open_4002],
|
||||
[ BDB_LIBS="-ldb" ],
|
||||
AC_CHECK_LIB([db41], [__db_ndbm_open],
|
||||
[ BDB_LIBS="-ldb41" ],
|
||||
AC_CHECK_LIB([db42], [__db_ndbm_open_4002],
|
||||
[ BDB_LIBS="-ldb42" ],
|
||||
BDB_NOT_FOUND=1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
fi
|
||||
|
||||
AC_SUBST(BDB_LIBS)
|
||||
|
||||
if test "x$BDB_NOT_FOUND" = "x1"; then
|
||||
echo "*** no db/dbm found, disabling verify cache"
|
||||
ENABLE_CACHE=0
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(ENABLE_CACHE, ${ENABLE_CACHE}, [enable cache])
|
||||
AC_DEFINE_UNQUOTED(ENABLE_STATS, ${ENABLE_STATS}, [enable stats])
|
||||
AC_DEFINE_UNQUOTED(ENABLE_NETSNMP, ${ENABLE_NETSNMP}, [enable Net-SNMP])
|
||||
|
||||
|
||||
|
||||
|
||||
dnl AC_SUBST(verify_BUILD)
|
||||
dnl AC_SUBST(test_BUILD)
|
||||
dnl AC_SUBST(cyrus_BUILD)
|
||||
|
||||
|
||||
AC_CONFIG_FILES([Makefile libsmmapdfw/Makefile smmapd/Makefile test_worker/Makefile verify_worker/Makefile cyrus_worker/Makefile doc/Makefile m4/Makefile mib/Makefile])
|
||||
|
||||
AC_OUTPUT
|
@ -1,41 +0,0 @@
|
||||
#include "count.h"
|
||||
|
||||
void count_init(count_t *c) {
|
||||
c->cnt = 0;
|
||||
|
||||
pthread_mutex_init(&c->mutex, NULL);
|
||||
}
|
||||
|
||||
void count_destroy(count_t *c) {
|
||||
pthread_mutex_destroy(&c->mutex);
|
||||
}
|
||||
|
||||
int count_inc(count_t *c) {
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&c->mutex);
|
||||
i = ++c->cnt;
|
||||
pthread_mutex_unlock(&c->mutex);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int count_dec(count_t *c) {
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&c->mutex);
|
||||
i = --c->cnt;
|
||||
pthread_mutex_unlock(&c->mutex);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int count_get(count_t *c) {
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&c->mutex);
|
||||
i = c->cnt;
|
||||
pthread_mutex_unlock(&c->mutex);
|
||||
|
||||
return i;
|
||||
}
|
5
smmapdfw/cyrus_worker/Makefile.am
Normal file
5
smmapdfw/cyrus_worker/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
lib_LTLIBRARIES = libcyrus_worker.la
|
||||
libcyrus_worker_la_SOURCES = cyrus_worker.c
|
||||
libcyrus_worker_la_LIBADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
362
smmapdfw/cyrus_worker/Makefile.in
Normal file
362
smmapdfw/cyrus_worker/Makefile.in
Normal file
@ -0,0 +1,362 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
lib_LTLIBRARIES = libcyrus_worker.la
|
||||
libcyrus_worker_la_SOURCES = cyrus_worker.c
|
||||
libcyrus_worker_la_LIBADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libcyrus_worker_la_LDFLAGS =
|
||||
libcyrus_worker_la_DEPENDENCIES = ../libsmmapdfw/libsmmapdfw.la
|
||||
libcyrus_worker_la_OBJECTS = cyrus_worker.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cyrus_worker.P
|
||||
SOURCES = $(libcyrus_worker_la_SOURCES)
|
||||
OBJECTS = $(libcyrus_worker_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu cyrus_worker/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libcyrus_worker.la: $(libcyrus_worker_la_OBJECTS) $(libcyrus_worker_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libcyrus_worker_la_LDFLAGS) $(libcyrus_worker_la_OBJECTS) $(libcyrus_worker_la_LIBADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP))
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = cyrus_worker
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu cyrus_worker/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-depend \
|
||||
distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -1,3 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
@ -6,7 +26,9 @@
|
||||
#include "smmapd.h"
|
||||
|
||||
#include "smtp.h"
|
||||
#include "dns.h"
|
||||
#include "htdns.h"
|
||||
#include "htmalloc.h"
|
||||
#include "stats.h"
|
||||
|
||||
#define SMM_LOCAL_PERM_NOK 101
|
||||
#define SMM_LOCAL_TEMP_NOK 102
|
||||
@ -25,6 +47,7 @@ struct cyrus_container_handle_s {
|
||||
typedef struct cyrus_container_handle_s cyrus_container_handle_t;
|
||||
|
||||
|
||||
|
||||
struct cyrus_work_handle_s {
|
||||
int id;
|
||||
cyrus_container_handle_t *cch;
|
||||
@ -36,25 +59,25 @@ typedef struct cyrus_work_handle_s cyrus_work_handle_t;
|
||||
|
||||
int cyrus_init(cfgl_t *cfg, void **handle);
|
||||
int cyrus_destroy(void *handle);
|
||||
/* int cyrus_work_setup(void *handle, void **work_handle); */
|
||||
/* int cyrus_work_setup(void *handle, void **work_handle); */
|
||||
int cyrus_work(void *handle, void *work_handle, char *input, char *output);
|
||||
/* int cyrus_work_destroy(void *handle, void *work_handle); */
|
||||
/* int cyrus_work_destroy(void *handle, void *work_handle); */
|
||||
|
||||
|
||||
class_descriptor_t cyruscheck = {
|
||||
"cyruscheck",
|
||||
&cyrus_init,
|
||||
&cyrus_destroy,
|
||||
NULL, /* &verify_work_setup, */
|
||||
NULL, /* &cyrus_work_setup, */
|
||||
&cyrus_work,
|
||||
NULL /* &cyrus_work_destroy */
|
||||
NULL /* &cyrus_work_destroy */
|
||||
};
|
||||
|
||||
|
||||
int cyrus_init(cfgl_t *cfg, void **handle) {
|
||||
cyrus_container_handle_t *cch;
|
||||
|
||||
cch = (cyrus_container_handle_t*) malloc(sizeof(cyrus_container_handle_t));
|
||||
cch = (cyrus_container_handle_t*) htmalloc(sizeof(cyrus_container_handle_t));
|
||||
cch->cfg = cfg;
|
||||
|
||||
cch->timeout = atoi(findcfglx(cch->cfg, "timeout", "5"));
|
||||
@ -74,6 +97,8 @@ int cyrus_destroy(void *handle) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
static const char *DEFAULT_ANSWER = "default answer";
|
||||
static const char *ILLEGAL_INPUT = "illegal input (must be 'depot_uid depot_host')";
|
||||
@ -82,6 +107,8 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
static const char *GO_AHEAD = "go ahead";
|
||||
static const char *DEPOT_DNS_ERROR = "depot could not be found in dns";
|
||||
|
||||
static int log_id = 0;
|
||||
|
||||
cyrus_container_handle_t *cch = (cyrus_container_handle_t*) handle;
|
||||
int result = SMM_TEMP_NOK;
|
||||
char *depot_uid, *depot_host, *response_text, *tmp_arg;
|
||||
@ -95,12 +122,16 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
} state = CONNECT;
|
||||
|
||||
|
||||
log_id++;
|
||||
|
||||
syslog(LOG_DEBUG, "cyrus_work: going to check %s", input);
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) going to check %s", log_id, input);
|
||||
|
||||
incStatCounter(STAT_CNT_CYRUS_WORKER);
|
||||
|
||||
depot_uid = input;
|
||||
if (NULL == (depot_host = strchr(depot_uid, ' '))) {
|
||||
snprintf(output, ANSWER_BUFSIZE, ILLEGAL_INPUT);
|
||||
incStatCounter(STAT_CNT_CYRUS_ILLEGAL_INPUT);
|
||||
return SMM_PERM_NOK;
|
||||
}
|
||||
|
||||
@ -110,9 +141,10 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
|
||||
a_rdata = get_a_rrs(depot_host);
|
||||
if (NULL == a_rdata) {
|
||||
syslog(LOG_DEBUG, "cyrus_work: depot_host %s could not be found in dns",
|
||||
depot_host);
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) depot_host %s could not be found in dns",
|
||||
log_id, depot_host);
|
||||
snprintf(output, ANSWER_BUFSIZE, DEPOT_DNS_ERROR);
|
||||
incStatCounter(STAT_CNT_CYRUS_DEPOT_DNS_FAILURE);
|
||||
return SMM_TEMP_NOK;
|
||||
}
|
||||
|
||||
@ -120,13 +152,14 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
free_rrs((void**)a_rdata);
|
||||
|
||||
|
||||
syslog(LOG_DEBUG, "cyrus_work: depot_uid %s, depot_host %s", depot_uid, depot_host);
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) depot_uid %s, depot_host %s", log_id,
|
||||
depot_uid, depot_host);
|
||||
|
||||
|
||||
lmtp = smtp_init(ip_address, cch->lmtp_port, cch->timeout);
|
||||
|
||||
while ((END != state) && (0 == done)) {
|
||||
syslog(LOG_DEBUG, "cyrus_work, lmtp dialog state %d", state);
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) lmtp dialog state %d", log_id, state);
|
||||
switch(state) {
|
||||
case CONNECT:
|
||||
err = smtp_connect(lmtp);
|
||||
@ -138,7 +171,7 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
err = smtp_mailfrom(lmtp, cch->sender_address);
|
||||
break;
|
||||
case RCPTTO:
|
||||
tmp_arg = (char*) malloc(sizeof(char) * (strlen(depot_uid)+5));
|
||||
tmp_arg = (char*) htmalloc(sizeof(char) * (strlen(depot_uid)+5));
|
||||
*tmp_arg = '\0';
|
||||
strcat(tmp_arg, "<");
|
||||
strcat(tmp_arg, depot_uid);
|
||||
@ -158,7 +191,7 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
|
||||
switch(err) {
|
||||
case SMTP_TIMEOUT:
|
||||
syslog(LOG_DEBUG, "cyrus_work, timeout in lmtp dialog");
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) timeout in lmtp dialog", log_id);
|
||||
result = SMM_LOCAL_TEMP_NOK;
|
||||
response_text = (char*)TIMEOUT_ERROR;
|
||||
done = 1;
|
||||
@ -167,13 +200,14 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
/* evaluate smtp_response, return or continue */
|
||||
err = smtp_response(lmtp, &response_text);
|
||||
if (-1 == err) {
|
||||
syslog(LOG_DEBUG, "cyrus_work, response could not be parsed");
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) response could not be parsed", log_id);
|
||||
result = SMM_LOCAL_TEMP_NOK;
|
||||
response_text = (char*)UNEXPECTED_ERROR;
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
syslog(LOG_DEBUG, "cyrus_work, response: %d, %s", err, response_text);
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) response: %d, %s", log_id,
|
||||
err, response_text);
|
||||
switch(err/100) {
|
||||
case 4:
|
||||
result = SMM_LOCAL_TEMP_NOK;
|
||||
@ -193,7 +227,7 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_DEBUG, "cyrus_work, unexpected error in lmtp dialog");
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) unexpected error in lmtp dialog", log_id);
|
||||
result = SMM_LOCAL_TEMP_NOK;
|
||||
response_text = (char*)UNEXPECTED_ERROR;
|
||||
done = 1;
|
||||
@ -208,14 +242,17 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
case SMM_LOCAL_TEMP_NOK:
|
||||
snprintf(output, ANSWER_BUFSIZE, "<TNOK><%s>", response_text);
|
||||
result = SMM_OK;
|
||||
incStatCounter(STAT_CNT_CYRUS_RETURNED_TNOK);
|
||||
break;
|
||||
case SMM_LOCAL_PERM_NOK:
|
||||
snprintf(output, ANSWER_BUFSIZE, "<NOK><%s>", response_text);
|
||||
result = SMM_OK;
|
||||
incStatCounter(STAT_CNT_CYRUS_RETURNED_NOK);
|
||||
break;
|
||||
case SMM_LOCAL_OK:
|
||||
snprintf(output, ANSWER_BUFSIZE, "<OK><%s>", response_text);
|
||||
result = SMM_OK;
|
||||
incStatCounter(STAT_CNT_CYRUS_RETURNED_OK);
|
||||
break;
|
||||
default:
|
||||
snprintf(output, ANSWER_BUFSIZE, response_text);
|
||||
@ -224,6 +261,8 @@ int cyrus_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
|
||||
smtp_destroy(lmtp);
|
||||
|
||||
syslog(LOG_DEBUG, "cyrus_work: (%04x) result %d, %s", log_id,
|
||||
result, output);
|
||||
|
||||
return result;
|
||||
}
|
1
smmapdfw/doc/Makefile.am
Normal file
1
smmapdfw/doc/Makefile.am
Normal file
@ -0,0 +1 @@
|
||||
info_TEXINFOS = smmapdfw.texi
|
325
smmapdfw/doc/Makefile.in
Normal file
325
smmapdfw/doc/Makefile.in
Normal file
@ -0,0 +1,325 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
info_TEXINFOS = smmapdfw.texi
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
TEXI2DVI = texi2dvi
|
||||
INFO_DEPS = smmapdfw.info
|
||||
DVIS = smmapdfw.dvi
|
||||
TEXINFOS = smmapdfw.texi
|
||||
DIST_COMMON = README Makefile.am Makefile.in texinfo.tex
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
smmapdfw.info: smmapdfw.texi
|
||||
smmapdfw.dvi: smmapdfw.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=.:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=.:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=.:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
uninstall-info:
|
||||
$(PRE_UNINSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
test -z "$$ii" \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
list='$(INFO_DEPS)'; \
|
||||
for base in $$list; do \
|
||||
d=$(srcdir); \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f smmapdfw.aux smmapdfw.cp smmapdfw.cps smmapdfw.dvi smmapdfw.fn \
|
||||
smmapdfw.fns smmapdfw.ky smmapdfw.kys smmapdfw.ps \
|
||||
smmapdfw.log smmapdfw.pg smmapdfw.toc smmapdfw.tp \
|
||||
smmapdfw.tps smmapdfw.vr smmapdfw.vrs smmapdfw.op smmapdfw.tr \
|
||||
smmapdfw.cv smmapdfw.cn
|
||||
|
||||
clean-aminfo:
|
||||
|
||||
distclean-aminfo:
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
cd $(srcdir) && for i in $(INFO_DEPS); do \
|
||||
rm -f $$i; \
|
||||
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
|
||||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = doc
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu doc/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info-am: $(INFO_DEPS)
|
||||
info: info-am
|
||||
dvi-am: $(DVIS)
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-info-am
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-info
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(INFO_DEPS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-aminfo mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-aminfo clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-aminfo distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir \
|
||||
info-am info dvi-am dvi check check-am installcheck-am installcheck \
|
||||
install-exec-am install-exec install-data-am install-data install-am \
|
||||
install uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -13,6 +13,7 @@ Copyright @copyright{} 2004 Wolfgang Hottgenroth
|
||||
@titlepage
|
||||
@title smmapdfw
|
||||
@subtitle A framework for workers for the sendmail socketmap
|
||||
@subtitle --- featuring a sender-address verifier and a Cyrus mailbox checker ---
|
||||
@author Wolfgang Hottgenroth
|
||||
|
||||
@page
|
||||
@ -32,6 +33,8 @@ Copyright @copyright{} 2004 Wolfgang Hottgenroth
|
||||
@menu
|
||||
* Motivation::
|
||||
* Overview::
|
||||
* Building smmapd from the sources::
|
||||
* Command line options::
|
||||
* Using from sendmail::
|
||||
* Configuration::
|
||||
* API::
|
||||
@ -39,29 +42,375 @@ Copyright @copyright{} 2004 Wolfgang Hottgenroth
|
||||
@detailmenu
|
||||
--- The Detailed Node Listing ---
|
||||
|
||||
Overview
|
||||
|
||||
* Sender-address verification plugin::
|
||||
* Cyrus mailbox check plugin::
|
||||
|
||||
Using from sendmail
|
||||
|
||||
* sender address verification::
|
||||
* Cyrus IMAP server mailbox checks::
|
||||
|
||||
Configuration
|
||||
|
||||
* Global::
|
||||
* Plugin::
|
||||
|
||||
Plugin
|
||||
|
||||
* Sender-address verifier::
|
||||
* Cyrus mailbox checker::
|
||||
|
||||
API
|
||||
|
||||
* Plugin interface::
|
||||
* Obtaining configuration data::
|
||||
* More or less useful stuff::
|
||||
|
||||
Plugin interface
|
||||
|
||||
* name::
|
||||
* Container setup function::
|
||||
* Container destroy function::
|
||||
* Worker setup function::
|
||||
* Worker destroy function::
|
||||
* Worker function::
|
||||
|
||||
Obtaining configuration data
|
||||
|
||||
* Without default value::
|
||||
* With default value::
|
||||
|
||||
More or less useful stuff
|
||||
|
||||
* count.h::
|
||||
* queue.h::
|
||||
* htdns.h::
|
||||
* htmalloc.h::
|
||||
* smtp.h::
|
||||
* safe_write.h::
|
||||
|
||||
@end detailmenu
|
||||
@end menu
|
||||
|
||||
@node Motivation, Overview, Top, Top
|
||||
@chapter Motivation
|
||||
Why smmapdfw
|
||||
With release 8.13 sendmail introduces the socket map type. A map can
|
||||
be defined where a query is sent over an socket to an external daemon,
|
||||
doing some computations on the query to send back the result over the
|
||||
socket.
|
||||
|
||||
@node Overview, Using from sendmail, Motivation, Top
|
||||
This opens another door to query data from external processes when
|
||||
performing mail routing. Thereby the already rich feature set of
|
||||
sendmail can be improved even more.
|
||||
|
||||
This framework provides all required stuff like a threaded tcp-server,
|
||||
the netstring codec, map name dispatching, configuration file
|
||||
processing and more, so someone who likes to design and implement a
|
||||
particular socket map and concentrate completely on the particular
|
||||
task the socket map has to perform.
|
||||
|
||||
The particular socket map processor appears as a shared object which
|
||||
is dynamically loaded by the daemon depending on the configuration.
|
||||
|
||||
@node Overview, Building smmapd from the sources, Motivation, Top
|
||||
@chapter Overview
|
||||
Overview over smmapdfw
|
||||
smmapdfw consists of the actual server -- smmapd --, a library --
|
||||
libsmmapdfw -- providing the API and three plugins, one useless
|
||||
example and two more useful ones: a sender-address verifier and a
|
||||
Cyrus mailbox checker.
|
||||
|
||||
@node Using from sendmail, Configuration, Overview, Top
|
||||
The server reads the configuration file, loads all configured plugins
|
||||
(socket map processors) and opens the configured tcp socket. It
|
||||
accepts requests on this tcp socket from sendmail in netstring
|
||||
encoding. For each connections it starts a thread. In this thread it
|
||||
dispatches the requests (the map name is part of the request) -- after
|
||||
decoding it from netstring and stripping the map name -- to the
|
||||
particular socket map processors. Afterwards it returns the result of
|
||||
the socket map processor -- after encoding it into netstring -- to
|
||||
sendmail.
|
||||
|
||||
The library provides all functions and types defined by the API. For
|
||||
details go ahead to the API section.
|
||||
|
||||
The socket map processors are implemented as plugins which are
|
||||
registered and loaded at run-time. They have to implement a worker
|
||||
function and may implement container and worker setup and destroy
|
||||
functions.
|
||||
|
||||
For each plugin two handles may be created: the container handle can
|
||||
be created at server start up time and lasts the whole lifetime of the
|
||||
server, the worker handle is created when a request is dispatched to a
|
||||
plugin and lasts for all requests coming in during the
|
||||
connection.
|
||||
|
||||
The container setup function, which a plugin can implement, is called
|
||||
at start up time, and returns the container handle.
|
||||
|
||||
The worker setup function, which a plugin can implement, is called
|
||||
when the first request of a connection is dispatched to the plugin,
|
||||
and returns the worker handle.
|
||||
|
||||
Both container and worker handle are provided to the worker function.
|
||||
|
||||
The framework stores both container and worker handle as void pointer,
|
||||
so each plugin has to define its own handle data structure.
|
||||
|
||||
|
||||
@menu
|
||||
* Sender-address verification plugin::
|
||||
* Cyrus mailbox check plugin::
|
||||
@end menu
|
||||
|
||||
@node Sender-address verification plugin, Cyrus mailbox check plugin, Overview, Overview
|
||||
@section Sender-address verification plugin
|
||||
This plugin performs verifications of sender-addresses.
|
||||
|
||||
An m4 file -- @file{verifysender.m4} -- providing a sendmail feature is
|
||||
part of the smmapdfw distribution.
|
||||
|
||||
To verify a sender-address, the plugin looks up the primary MX record
|
||||
of the domain of the sender-address and all IP addresses belonging to
|
||||
the found MX names.
|
||||
|
||||
For each IP address it starts a checker thread. Each checker thread
|
||||
starts an smtp dialog to the mail-server listening on the IP. It stops
|
||||
the dialog after an failure or latest after the @code{rcpt} command.
|
||||
It uses a configurable address as sender and the address under test as
|
||||
recipient. It collects the result given after the @code{rcpt} and
|
||||
returns depending on the code OK, temporary or permanent failure.
|
||||
|
||||
The first checker thread returning a permanent result (OK or permanent
|
||||
failure) wins and its result is stored in the cache (if enabled) and
|
||||
returned to sendmail.
|
||||
|
||||
If no checker thread delivers a permanent result within the result
|
||||
timeout, a temporary failure is returned. However, no checker thread
|
||||
is aborted and the result of the first one is then just stored in the
|
||||
cache.
|
||||
|
||||
|
||||
@node Cyrus mailbox check plugin, , Sender-address verification plugin, Overview
|
||||
@section Cyrus mailbox checker
|
||||
When sendmail performs final delivery via lmtp to a Cyrus IMAP server
|
||||
and the IMAP server returns a overquota failure, sendmail is in a
|
||||
somewhat unlucky position since it already has accepted the mail and
|
||||
nevertheless can not deliver it. It has to keep it in the queue. (So,
|
||||
the quota of a mailbox is unlimitly extended into sendmail's queue.)
|
||||
|
||||
Unlucky enough, but usually after five days of repeated unsuccessful
|
||||
delivery attempt the message is returned to its sender.
|
||||
|
||||
But it comes even more bad: the sender-address might be invalid, and
|
||||
now the message can not be returned.
|
||||
|
||||
So, it would be good to reject the message directly in the smtp dialog
|
||||
if the recipients mailbox is overquota.
|
||||
|
||||
Again, an m4 file -- @file{cyruscheck.m4} -- providing a sendmail
|
||||
feature is part of this distribution.
|
||||
|
||||
It hooks into the local parse ruleset and checks through the map
|
||||
utilizing this plugin the Cyrus IMAP server to see whether the
|
||||
particular mailbox can store more mail.
|
||||
|
||||
@node Building smmapd from the sources, Command line options, Overview, Top
|
||||
@chapter Building smmapd from the sources
|
||||
smmapd comes with a autoconf @file{configure} script.
|
||||
|
||||
To get some help for the parameters it supports, say
|
||||
|
||||
@verbatim
|
||||
./configure --help
|
||||
@end verbatim
|
||||
|
||||
Important options are these:
|
||||
|
||||
@verbatim
|
||||
--enable-stats Enables statistics collection. (default=no)
|
||||
--with-bdb-lib-dir Directory for Berkeley DB library files
|
||||
--with-bdb-inc-dir Directory for Berkeley include files
|
||||
--with-djbdns-lib-dir Directory for Bernstein's djbdns library files
|
||||
--with-djbdns-inc-dir Directory for Bernstein's djbdns include files
|
||||
--with-netsnmp With Net-SNMP
|
||||
--with-netsnmp-lib-dir Directory for Net-SNMP library files
|
||||
--with-netsnmp-inc-dir Directory for Net-SNMP include files
|
||||
--with-netsnmp-bin-dir Directory for Net-SNMP bin files, specifically
|
||||
net-snmp-config
|
||||
@end verbatim
|
||||
|
||||
The Berkeley DB (tested with version 4.1.25) is required for the cache
|
||||
of the verifier plugin.
|
||||
|
||||
DJB's resolver library (djbdns) is required on systems where the
|
||||
default resolver library is not thread-safe. (In my test-bed this was
|
||||
true for Solaris 8.)
|
||||
|
||||
To gather statistic data, use @code{--enable-stats}, to be able to
|
||||
retrieve statistic data through snmp use @code{--with-netsnmp}. snmp
|
||||
requires @code{--enable-stats}. If there are no direct paths to the
|
||||
Net-SNMP stuff (tested with Net-SNMP 5.1.2), use
|
||||
@code{--with-netsnmp-lib-dir}, @code{--with-netsnmp-inc-dir} and
|
||||
@code{--with-netsnmp-bin-dir}.
|
||||
|
||||
|
||||
@node Command line options, Using from sendmail, Building smmapd from the sources, Top
|
||||
@chapter Command line options
|
||||
|
||||
@table @code
|
||||
@item -F
|
||||
Run smmapd in foreground instead of daemonizing. Overwrites the
|
||||
@code{do_fork} configuration option.
|
||||
|
||||
@item -f <config-file>
|
||||
Use the given configuration file instead of the default one.
|
||||
|
||||
@item -p <pid-file>
|
||||
Write the pid when daemonizing to the given pid file instead of the
|
||||
one mentioned in the configuration file.
|
||||
|
||||
@item -v
|
||||
Display version information.
|
||||
|
||||
@item -h
|
||||
Display usage information.
|
||||
@end table
|
||||
|
||||
|
||||
@node Using from sendmail, Configuration, Command line options, Top
|
||||
@chapter Using from sendmail
|
||||
How to use smmapdfw from sendmail
|
||||
|
||||
To use a socket map in sendmail, it must be defined in the cf:
|
||||
|
||||
@verbatim
|
||||
Kverifier socket -T<temp> inet:8884@127.0.0.1
|
||||
@end verbatim
|
||||
|
||||
Then, the socket map can be used in rules as any other map too:
|
||||
|
||||
@verbatim
|
||||
R< $+ > $: < $1 > < $(verifier $1 $:none $) >
|
||||
@end verbatim
|
||||
|
||||
|
||||
Many socket maps can use the same socket:
|
||||
|
||||
@verbatim
|
||||
Kverifier socket -T<temp> inet:8884@127.0.0.1
|
||||
Kcyruscheck socket -T<temp> inet:8884@127.0.0.1
|
||||
Kdontknow socket -T<temp> inet:8884@127.0.0.1
|
||||
@end verbatim
|
||||
|
||||
(Here, the dispatcher of smmapdfw jumps in.)
|
||||
|
||||
@menu
|
||||
* sender address verification::
|
||||
* Cyrus IMAP server mailbox checks::
|
||||
@end menu
|
||||
|
||||
@node sender address verification, Cyrus IMAP server mailbox checks, Using from sendmail, Using from sendmail
|
||||
@section sender address verification
|
||||
|
||||
A sendmail feature file is delivered with smmapd to link the sender
|
||||
address verification into the ruleset @code{check_mail} hook
|
||||
@code{Local_check_mail}.
|
||||
|
||||
It takes three parameters and can be used in the @code{sendmail.mc}
|
||||
like this:
|
||||
|
||||
@verbatim
|
||||
FEATURE(`verifysender', `_mode_', `_return_', `_dummy_')
|
||||
@end verbatim
|
||||
|
||||
@code{_mode_} must be replaced by either @code{black} or
|
||||
@code{white}.
|
||||
|
||||
For @code{black} a blacklist in
|
||||
@code{/etc/mail/verifier-black-list} is considered and only sender
|
||||
addresses in there mentioned domains are verified.
|
||||
|
||||
The location of the blacklist can be configured using
|
||||
|
||||
@verbatim
|
||||
define(`confVERIFIER_BLACKLIST', `hash -o /prod/sendmail/etc/verifier-black-list')
|
||||
@end verbatim
|
||||
|
||||
|
||||
For @code{white} a whitelist in
|
||||
@code{/etc/mail/verifier-white-list} is considered and sender
|
||||
addresses in the whitelist or in domains mentioned in the whitelist
|
||||
are not verified.
|
||||
|
||||
The location of the whitelist can be configured using
|
||||
|
||||
@verbatim
|
||||
define(`confVERIFIER_WHITELIST', `hash -o /prod/sendmail/etc/verifier-white-list')
|
||||
@end verbatim
|
||||
|
||||
@code{confVERIFIER_BLACKLIST} and @code{confVERIFIER_WHITELIST} must
|
||||
appear in the @code{sendmail.mc} before the feature is called.
|
||||
|
||||
@code{_return_} must be replaced by either @code{temp} or
|
||||
@code{perm}.
|
||||
|
||||
If the sender address verification ends up in a permanent negative
|
||||
response from the home-server of the address, for @code{temp} a
|
||||
temporary failure (4xx), for @code{perm} a permanent
|
||||
failure (5xx) is returned.
|
||||
|
||||
@code{_dummy_} must be replaced by either @code{active} or
|
||||
@code{dummy}. If @code{dummy} is set here, the verifier is called but
|
||||
its result is just logged and not further considered for the routing.
|
||||
|
||||
The connection to the smmapd is configured using
|
||||
@code{define(`confVERIFIER_MAP')}.
|
||||
The default is
|
||||
|
||||
@verbatim
|
||||
define(`confVERIFIER_MAP', `inet:8884@127.0.0.1')
|
||||
@end verbatim
|
||||
|
||||
@node Cyrus IMAP server mailbox checks, , sender address verification, Using from sendmail
|
||||
@section Cyrus IMAP server mailbox checks
|
||||
|
||||
|
||||
A sendmail feature file @code{cyruscheck.m4} is delivered with
|
||||
smmapd. It provides a ruleset @code{cyruscheck}, which can by used in
|
||||
ruleset @code{ParseLocal}.
|
||||
|
||||
It can be used in the @code{sendmail.mc} like this:
|
||||
|
||||
@verbatim
|
||||
FEATURE(`cyruscheck', `_dummy_')
|
||||
@end verbatim
|
||||
|
||||
@code{_dummy_} must be replaced by either @code{active} or
|
||||
@code{dummy}. If @code{dummy} is set here, the verifier is called but
|
||||
its result is just logged and not further considered for the routing.
|
||||
|
||||
However, remember that only the ruleset @code{cyruscheck} is
|
||||
provided. You need to call it in your @code{LocalParse} ruleset on
|
||||
your own.
|
||||
|
||||
The ruleset takes two parameters: The mailbox name on the Cyrus IMAP
|
||||
server and the hostname of the Cyrus IMAP server, both in angle brackets.
|
||||
|
||||
The connection to the smmapd is configured using
|
||||
@code{define(`confCYRUSCHECK_MAP')}.
|
||||
The default is
|
||||
|
||||
@verbatim
|
||||
define(`confCYRUSCHECK_MAP', `inet:8884@127.0.0.1')
|
||||
@end verbatim
|
||||
|
||||
|
||||
|
||||
@node Configuration, API, Using from sendmail, Top
|
||||
@chapter Configuration
|
||||
How to configure smmapdfw
|
||||
The configuration file of smmapdfw has one global section, for the
|
||||
server itself and one section for each plugin.
|
||||
|
||||
|
||||
@menu
|
||||
* Global::
|
||||
@ -70,11 +419,202 @@ How to configure smmapdfw
|
||||
|
||||
@node Global, Plugin, Configuration, Configuration
|
||||
@section Global
|
||||
Global configuration items
|
||||
|
||||
@verbatim
|
||||
[global]
|
||||
do_fork = 0
|
||||
pid_file = smmapd.pid
|
||||
address = 127.0.0.1
|
||||
port = 8887
|
||||
; plugin_dir = /home/who/Sources/sf/smmapdfw
|
||||
; plugins = test_worker1 test_worker2 verifier cyruscheck lua_worker
|
||||
plugins = verifier
|
||||
enable_stats = 1
|
||||
enable_snmp = 1
|
||||
|
||||
|
||||
|
||||
@end verbatim
|
||||
|
||||
@table @samp
|
||||
@item do_fork
|
||||
Should the server fork into background. 0 or 1. May be overwritten by
|
||||
@code{-F} commandline switch.
|
||||
|
||||
@item pid_file
|
||||
Path and filename of the pidfile. May be overwritten by @code{-p}
|
||||
commandline switch.
|
||||
|
||||
@item address
|
||||
Address to bind socket on. Leave it out to bind on @code{IN_ANYADDR}.
|
||||
|
||||
@item port
|
||||
Port to bind socket on.
|
||||
|
||||
@item plugin_dir
|
||||
Directory where plugins can be found. Usually this parameter is not
|
||||
required, when plugins are installed in the lib path configured when
|
||||
building smmapdfw. Only one path can be given.
|
||||
|
||||
@item plugins
|
||||
Lists all plugins separated by spaces which should be loaded. The plugin name refers to
|
||||
the section name of the particular configuration section.
|
||||
|
||||
@item enable_stats
|
||||
This enables the statistics output thread. It is only available when
|
||||
smmapd was built with @code{--enable-stats}. Further configuration in
|
||||
section @code{stats} is required.
|
||||
|
||||
@item enable_snmp
|
||||
This enables the snmp AgentX subagent to retrieve statistic data. It
|
||||
is only available when smmapd was built with @code{--enable-stats} and
|
||||
@code{--with-netsnmp}. Further configuration in section @code{snmp} is required.
|
||||
@end table
|
||||
|
||||
|
||||
|
||||
@section stats
|
||||
|
||||
@verbatim
|
||||
[stats]
|
||||
stdout_nice = 2
|
||||
syslog_nice =1
|
||||
period = 1
|
||||
@end verbatim
|
||||
|
||||
The statistics output thread can write to stdout and/or syslog in two
|
||||
different format, one more human-readable, the other one more
|
||||
machine-readable.
|
||||
|
||||
The number after @code{stdout_nice} and @code{syslog_nice} specifies
|
||||
the format. 0 means no output on this channel, 1 means
|
||||
machine-readable output and 2 means human-readable output.
|
||||
|
||||
@code{period} specifies the time in seconds behind to statistic
|
||||
outputs.
|
||||
|
||||
@section snmp
|
||||
|
||||
@verbatim
|
||||
[snmp]
|
||||
agentx_socket = /var/agentx/master
|
||||
@end verbatim
|
||||
|
||||
The socket on which the snmpd is listening for AgentX subagents is
|
||||
specified here.
|
||||
|
||||
|
||||
@node Plugin, , Global, Configuration
|
||||
@section Plugin
|
||||
General plugin configuration items
|
||||
The section name of a plugin configuration section must be used in the
|
||||
@code{plugins} parameter of the @code{global} section.
|
||||
|
||||
Each plugin section must have at least the name of the shared object
|
||||
file from which the plugin should be loaded in the parameter @code{obj}.
|
||||
|
||||
All other parameters a completely under the control of the plugin
|
||||
designer/implementor.
|
||||
|
||||
@menu
|
||||
* Sender-address verifier::
|
||||
* Cyrus mailbox checker::
|
||||
@end menu
|
||||
|
||||
@node Sender-address verifier, Cyrus mailbox checker, Plugin, Plugin
|
||||
@subsection Sender-address verifier
|
||||
|
||||
@verbatim
|
||||
[verifier]
|
||||
obj = libverify_worker.so
|
||||
timeout_result = 5
|
||||
timeout_dialog = 20
|
||||
cache_enabled = 1
|
||||
cache_expiry = 86400
|
||||
cache_file = /var/lib/smmapdfw/verifier.cache
|
||||
sender_address = <>
|
||||
ehlo_arg = local
|
||||
smtp_port = 25
|
||||
max_checker_threads = 100
|
||||
|
||||
@end verbatim
|
||||
|
||||
|
||||
@table @samp
|
||||
@item obj
|
||||
The plugin should be loaded from the file @code{libverify_worker.so}.
|
||||
|
||||
@item timeout_result
|
||||
The plugin will return a result latest after this timeout. If there is
|
||||
no result at this time, a temporary failure will be returned. However,
|
||||
running verifications will not be aborted, so their results can go
|
||||
into the cache.
|
||||
|
||||
@item timeout_dialog
|
||||
Timeout for the smtp dialog to home servers of sender-addresses.
|
||||
|
||||
@item cache_enable
|
||||
Cache permenant results of verifications.
|
||||
|
||||
@item cache_expiry
|
||||
Expiry time of entries in the cache.
|
||||
|
||||
@item cache_file
|
||||
Path and filename of the cache.
|
||||
|
||||
@item sender_address
|
||||
This address will be used as sender-address in the verification
|
||||
dialog. Use some special to avoid verification loops. The address must
|
||||
be given in exactly that notation it should be used in the dialog.
|
||||
|
||||
@item ehlo_arg
|
||||
Argument to the @code{ehlo} command in the verification dialog. Note
|
||||
that certain MTA's require a full qualified domain name.
|
||||
|
||||
@item smtp_port
|
||||
Port to be used for smtp verification dialog.
|
||||
|
||||
@item max_checker_threads
|
||||
The verifier plugin looks up the primary MX for a sender-address and
|
||||
resolves all IP addresses for the found MX records. For each IP
|
||||
address it starts one checker thread. (The first one returning a
|
||||
permenant result wins.) This parameter limits the number of checker
|
||||
threads.
|
||||
@end table
|
||||
|
||||
@node Cyrus mailbox checker, , Sender-address verifier, Plugin
|
||||
@subsection Cyrus mailbox checker
|
||||
|
||||
@verbatim
|
||||
[cyruscheck]
|
||||
obj = libcyrus_worker.so
|
||||
timeout = 10
|
||||
sender_address = <testsender>
|
||||
lhlo_arg = local
|
||||
lmtp_port = 24
|
||||
|
||||
@end verbatim
|
||||
|
||||
|
||||
@table @samp
|
||||
@item obj
|
||||
The cyrus mailbox checker should be loaded from the file
|
||||
@code{libcyrus_worker.so}.
|
||||
|
||||
@item timeout
|
||||
Timeout for the lmtp dialog.
|
||||
|
||||
@item sender_address
|
||||
Address to be used as sender in the lmtp dialog.
|
||||
|
||||
@item lhlo_arg
|
||||
Argument for @code{lhlo} in the lmtp dialog.
|
||||
|
||||
@item lmtp_port
|
||||
Port to be used for the lmtp dialog.
|
||||
@end table
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -82,5 +622,315 @@ General plugin configuration items
|
||||
@chapter API
|
||||
API documentation for plugin programmers
|
||||
|
||||
@menu
|
||||
* Plugin interface::
|
||||
* Obtaining configuration data::
|
||||
* More or less useful stuff::
|
||||
@end menu
|
||||
|
||||
@node Plugin interface, Obtaining configuration data, API, API
|
||||
@section Plugin interface
|
||||
|
||||
Each plugin has to defined a class descriptor of the type
|
||||
@code{class_descriptor_t}.
|
||||
|
||||
@verbatim
|
||||
struct class_descriptor_s {
|
||||
char *name;
|
||||
int (*init_function)(cfgl_t *cfg, void **handle);
|
||||
int (*destroy_function)(void *handle);
|
||||
int (*work_setup_function)(void *handle, void **work_handle);
|
||||
int (*work_function)(void *handle, void *work_handle, char *input,
|
||||
char *output);
|
||||
int (*work_destroy_function)(void *handle, void *work_handle);
|
||||
};
|
||||
|
||||
typedef struct class_descriptor_s class_descriptor_t;
|
||||
|
||||
@end verbatim
|
||||
|
||||
The variable name of the class descriptor must be the same as the
|
||||
configuration section name from the configuration file. As an example:
|
||||
here is the descriptor of the verifier plugin:
|
||||
|
||||
@verbatim
|
||||
class_descriptor_t verifier = {
|
||||
"verifier",
|
||||
&verify_init,
|
||||
&verify_destroy,
|
||||
&verify_work_setup,
|
||||
&verify_work,
|
||||
&verify_work_destroy
|
||||
};
|
||||
|
||||
@end verbatim
|
||||
|
||||
@menu
|
||||
* name::
|
||||
* Container setup function::
|
||||
* Container destroy function::
|
||||
* Worker setup function::
|
||||
* Worker destroy function::
|
||||
* Worker function::
|
||||
@end menu
|
||||
|
||||
@node name, Container setup function, Plugin interface, Plugin interface
|
||||
@subsection @code{name}
|
||||
|
||||
This is the name of the plugin. It must match to the name of the
|
||||
plugin descriptor and the name of the plugin's configuration section.
|
||||
|
||||
@node Container setup function, Container destroy function, name, Plugin interface
|
||||
@subsection Container setup function: @code{init_function}
|
||||
|
||||
@code{int (*init_function)(cfgl_t *cfg, void **handle);}
|
||||
|
||||
The Container setup function is called at start up time. A handle to
|
||||
access the configuration is handed over and the container handle is
|
||||
expected back.
|
||||
|
||||
Each plugin defines its own structure for the container
|
||||
handle. Certainly it will store the configuration handle within.
|
||||
|
||||
|
||||
@node Container destroy function, Worker setup function, Container setup function, Plugin interface
|
||||
@subsection Container destroy function: @code{destroy_function}
|
||||
|
||||
@code{int (*destroy_function)(void *handle);}
|
||||
|
||||
The Container destroy function is called when the plugin is
|
||||
unloaded. Is happens currently never.
|
||||
|
||||
However, free any resources allocated for the container within this
|
||||
function.
|
||||
|
||||
|
||||
@node Worker setup function, Worker destroy function, Container destroy function, Plugin interface
|
||||
@subsection Worker setup function: @code{work_setup_function}
|
||||
|
||||
@code{int (*work_setup_function)(void *handle, void **work_handle);}
|
||||
|
||||
The worker setup function is called when the first request of one
|
||||
connection is dispatched to the plugin. The container handle is
|
||||
provided, the worker handle is expected back.
|
||||
|
||||
Each plugin defines its own structure for the worker handle.
|
||||
|
||||
|
||||
@node Worker destroy function, Worker function, Worker setup function, Plugin interface
|
||||
@subsection Worker destroy function: @code{work_destroy_function}
|
||||
|
||||
@code{int (*work_destroy_function)(void *handle, void *work_handle);}
|
||||
|
||||
The worker destroy function is called when the connection associated
|
||||
with the worker is closed.
|
||||
|
||||
Free any resources allocated for this worker. Do not free resources
|
||||
associated with the container.
|
||||
|
||||
@node Worker function, , Worker destroy function, Plugin interface
|
||||
@subsection Worker function: @code{work_function}
|
||||
|
||||
@code{int (*work_function)(void *handle, void *work_handle, char *input, char *output);}
|
||||
|
||||
The worker function is called for each request dispatched to this
|
||||
plugin. The container handle, the worker handle and of course the
|
||||
input is provided.
|
||||
|
||||
The return value must be one of
|
||||
|
||||
@verbatim
|
||||
#define SMM_OK 1
|
||||
#define SMM_TEMP_NOK 2
|
||||
#define SMM_PERM_NOK 3
|
||||
#define SMM_NOT_FOUND_NOK 4
|
||||
|
||||
@end verbatim
|
||||
|
||||
which matches to the codes sendmail expects in the response from a
|
||||
socket map.
|
||||
|
||||
@code{output} is the text returned with the code to
|
||||
sendmail. Especially for @code{SMM_OK} this is the return value of the
|
||||
map.
|
||||
|
||||
|
||||
@node Obtaining configuration data, More or less useful stuff, Plugin interface, API
|
||||
@section Obtaining configuration data
|
||||
|
||||
Each plugin can easily obtain data from its own configuration section.
|
||||
|
||||
|
||||
@menu
|
||||
* Without default value::
|
||||
* With default value::
|
||||
@end menu
|
||||
|
||||
@node Without default value, With default value, Obtaining configuration data, Obtaining configuration data
|
||||
@subsection Without default value
|
||||
|
||||
@code{char *findcfgl(config_item_t *cfg, char *name);}
|
||||
|
||||
@table @samp
|
||||
@item cfg
|
||||
Configuration handle, handed over to the plugin through the container
|
||||
setup function.
|
||||
|
||||
@item name
|
||||
Name of the configuration parameter.
|
||||
@end table
|
||||
|
||||
The value of the request configuration parameter is returned. If it
|
||||
does not exist, @code{NULL} is returned.
|
||||
|
||||
@node With default value, , Without default value, Obtaining configuration data
|
||||
@subsection With default value
|
||||
|
||||
@code{char *findcfglx(config_item_t *cfg, char *name, char *default_value);}
|
||||
|
||||
@table @samp
|
||||
@item cfg
|
||||
Configuration handle, handed over to the plugin through the container
|
||||
setup function.
|
||||
|
||||
@item name
|
||||
Name of the configuration parameter.
|
||||
|
||||
@item default_value
|
||||
Default value to be returned instead of @code{NULL} if the parameter
|
||||
is not mentioned in the configuration file.
|
||||
@end table
|
||||
|
||||
|
||||
|
||||
@node More or less useful stuff, , Obtaining configuration data, API
|
||||
@section More or less useful stuff
|
||||
|
||||
The functions of the library are discussed here for each of the header files.
|
||||
|
||||
@menu
|
||||
* count.h::
|
||||
* queue.h::
|
||||
* htdns.h::
|
||||
* htmalloc.h::
|
||||
* smtp.h::
|
||||
* safe_write.h::
|
||||
@end menu
|
||||
|
||||
@node count.h, queue.h, More or less useful stuff, More or less useful stuff
|
||||
@subsection @code{count.h}
|
||||
|
||||
This is a threadsafe counter, wrapped around an @code{int}.
|
||||
|
||||
Define or allocate a handle of type @code{count_t} to use it.
|
||||
|
||||
It defines the following functions of hopefully obvious meaning:
|
||||
|
||||
@verbatim
|
||||
void count_init(count_t *c);
|
||||
void count_destroy(count_t *c);
|
||||
int count_inc(count_t *c);
|
||||
int count_dec(count_t *c);
|
||||
int count_get(count_t *c);
|
||||
@end verbatim
|
||||
|
||||
|
||||
@node queue.h, htdns.h, count.h, More or less useful stuff
|
||||
@subsection @code{queue.h}
|
||||
|
||||
This is a threadsafe queue. Pointers to anything (@code{void}) can be
|
||||
stored in it.
|
||||
|
||||
Define or allocate a handle of type @code{ht_queue_t} to use it.
|
||||
|
||||
It defines the following functions of hopefully obvious meaning:
|
||||
|
||||
@verbatim
|
||||
void queue_init(ht_queue_t *q);
|
||||
void queue_destroy(ht_queue_t *q);
|
||||
int queue_put(ht_queue_t *q, void *d);
|
||||
void *queue_get_wait(ht_queue_t *q);
|
||||
@end verbatim
|
||||
|
||||
|
||||
@node htdns.h, htmalloc.h, queue.h, More or less useful stuff
|
||||
@subsection @code{htdns.h}
|
||||
|
||||
This is a wrapper around the resolver library selected at build time
|
||||
(currently traditional @code{libresolv} or djbdns).
|
||||
|
||||
It defines the following functions:
|
||||
|
||||
@verbatim
|
||||
void free_rrs(void **resp);
|
||||
mx_rdata_t** get_mx_rrs(char *domain);
|
||||
mx_rdata_t** get_best_mx_rrs(char *domain);
|
||||
a_rdata_t** get_a_rrs(char *domain);
|
||||
cname_rdata_t** get_cname_rrs(char *domain);
|
||||
@end verbatim
|
||||
|
||||
For details on the data types look into the header file.
|
||||
|
||||
Don't forget to free anything you got using @code{free_rrs}.
|
||||
|
||||
@node htmalloc.h, smtp.h, htdns.h, More or less useful stuff
|
||||
@subsection @code{htmalloc.h}
|
||||
|
||||
This provides variants of @code{malloc}, @code{realloc} and
|
||||
@code{strdup} which either returns or in case of out-of-memory sends
|
||||
the whole process into nirwana.
|
||||
|
||||
@verbatim
|
||||
void *htmalloc(size_t size);
|
||||
void *htrealloc(void *ptr, size_t size);
|
||||
char *htstrdup(const char *s);
|
||||
@end verbatim
|
||||
|
||||
|
||||
@node smtp.h, safe_write.h, htmalloc.h, More or less useful stuff
|
||||
@subsection @code{smtp.h}
|
||||
|
||||
This is a simple smtp library, also useable for lmtp.
|
||||
|
||||
Define or allocate a handle of type @code{smtp_t} to use it.
|
||||
|
||||
@verbatim
|
||||
smtp_t *smtp_init2(char *host_address, int port, int timeout);
|
||||
smtp_t *smtp_init(unsigned int address, int port, int timeout);
|
||||
void smtp_destroy(smtp_t *handle);
|
||||
|
||||
int smtp_response(smtp_t *handle, char **response);
|
||||
int smtp_command(smtp_t *handle, char *command, char *arg);
|
||||
|
||||
int smtp_connect(smtp_t *handle);
|
||||
int smtp_close(smtp_t *handle);
|
||||
|
||||
int smtp_helo(smtp_t *handle, char *arg);
|
||||
int smtp_ehlo(smtp_t *handle, char *arg);
|
||||
int smtp_lhlo(smtp_t *handle, char *arg);
|
||||
int smtp_mailfrom(smtp_t *handle, char *arg);
|
||||
int smtp_rcptto(smtp_t *handle, char *arg);
|
||||
int smtp_data(smtp_t *handle);
|
||||
int smtp_datasend(smtp_t *handle, char *data);
|
||||
int smtp_dataend(smtp_t *handle);
|
||||
int smtp_rset(smtp_t *handle);
|
||||
int smtp_quit(smtp_t *handle);
|
||||
@end verbatim
|
||||
|
||||
Note: @code{host_address} in @code{smtp_init2} is a quad-dotted IP
|
||||
address, no hostname.
|
||||
|
||||
@node safe_write.h, , smtp.h, More or less useful stuff
|
||||
@subsection @code{safe_write.h}
|
||||
|
||||
@verbatim
|
||||
ssize_t safe_write(int fd, const void *buf, size_t count);
|
||||
@end verbatim
|
||||
|
||||
This is a @code{SIGPIPE} death avoiding write function. However, no
|
||||
input should be expected when trying to write with this function,
|
||||
since at least one input character is eaten up.
|
||||
|
||||
|
||||
|
||||
@bye
|
||||
|
6341
smmapdfw/doc/texinfo.tex
Normal file
6341
smmapdfw/doc/texinfo.tex
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
cat smmapd.c | grep '^#define RELEASE_ID' | awk '{print $3}' | sed 's/\"//g'
|
@ -1,39 +0,0 @@
|
||||
#ifndef _CONTAINERS_H_
|
||||
#define _CONTAINERS_H_
|
||||
|
||||
#define _SMMAPD_
|
||||
#include "containers_public.h"
|
||||
|
||||
struct classes_s {
|
||||
class_descriptor_t *descr;
|
||||
int id;
|
||||
void *handle;
|
||||
struct classes_s *next;
|
||||
};
|
||||
|
||||
typedef struct classes_s classes_t;
|
||||
|
||||
struct worker_handle_s {
|
||||
int id;
|
||||
void *handle;
|
||||
struct worker_handle_s *next;
|
||||
};
|
||||
|
||||
typedef struct worker_handle_s worker_handle_t;
|
||||
|
||||
struct container_handle_s {
|
||||
worker_handle_t worker_handle_root;
|
||||
};
|
||||
|
||||
typedef struct container_handle_s container_handle_t;
|
||||
|
||||
int containers_setup(container_handle_t **ch);
|
||||
int containers_destroy(container_handle_t *ch);
|
||||
int containers_dispatcher(container_handle_t *ch, char *input, char *output);
|
||||
|
||||
int register_all();
|
||||
|
||||
|
||||
#endif /* _CONTAINERS_H_ */
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
#ifndef _CONTAINERS_PUBLIC_H_
|
||||
#define _CONTAINERS_PUBLIC_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
struct class_descriptor_s {
|
||||
char *name;
|
||||
int (*init_function)(cfgl_t *cfg, void **handle);
|
||||
int (*destroy_function)(void *handle);
|
||||
int (*work_setup_function)(void *handle, void **work_handle);
|
||||
int (*work_function)(void *handle, void *work_handle, char *input, char *output);
|
||||
int (*work_destroy_function)(void *handle, void *work_handle);
|
||||
};
|
||||
|
||||
typedef struct class_descriptor_s class_descriptor_t;
|
||||
|
||||
|
||||
|
||||
#endif /* _CONTAINERS_PUBLIC_H_ */
|
@ -1,21 +0,0 @@
|
||||
#ifndef _COUNT_H_
|
||||
#define _COUNT_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct count_s {
|
||||
int cnt;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
typedef struct count_s count_t;
|
||||
|
||||
void count_init(count_t *c);
|
||||
void count_destroy(count_t *c);
|
||||
int count_inc(count_t *c);
|
||||
int count_dec(count_t *c);
|
||||
int count_get(count_t *c);
|
||||
|
||||
#endif /* _COUNT_H_ */
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
#ifndef _DNS_H_
|
||||
#define _DNS_H_
|
||||
|
||||
struct mx_rdata_s {
|
||||
int type;
|
||||
int preference;
|
||||
char *exchange;
|
||||
};
|
||||
|
||||
typedef struct mx_rdata_s mx_rdata_t;
|
||||
|
||||
struct a_rdata_s {
|
||||
int type;
|
||||
unsigned int address;
|
||||
};
|
||||
|
||||
typedef struct a_rdata_s a_rdata_t;
|
||||
|
||||
struct rdata_s {
|
||||
int type;
|
||||
union {
|
||||
mx_rdata_t mx;
|
||||
a_rdata_t a;
|
||||
} data;
|
||||
};
|
||||
|
||||
typedef struct rdata_s rdata_t;
|
||||
|
||||
|
||||
void free_rrs(void **resp);
|
||||
mx_rdata_t** get_mx_rrs(char *domain);
|
||||
mx_rdata_t** get_best_mx_rrs(char *domain);
|
||||
a_rdata_t** get_a_rrs(char *domain);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _DNS_H_ */
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
#ifndef _QUEUE_H_
|
||||
#define _QUEUE_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct queue_entry_s {
|
||||
void *data;
|
||||
struct queue_entry_s *next;
|
||||
struct queue_entry_s *prev;
|
||||
};
|
||||
|
||||
typedef struct queue_entry_s queue_entry_t;
|
||||
|
||||
struct queue_s {
|
||||
queue_entry_t *tail;
|
||||
queue_entry_t *head;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
typedef struct queue_s ht_queue_t;
|
||||
|
||||
void queue_init(ht_queue_t *q);
|
||||
void queue_destroy(ht_queue_t *q);
|
||||
int queue_put(ht_queue_t *q, void *d);
|
||||
void *queue_get_wait(ht_queue_t *q);
|
||||
|
||||
|
||||
#endif /* _QUEUE_H_ */
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
#ifndef _SAFE_WRITE_H_
|
||||
#define _SAFE_WRITE_H_
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define _SAFE_WRITE_READ_BUF_SIZE 256
|
||||
|
||||
|
||||
/* _safe_write avoids SIGPIPE when writing but it skips a part of an possible
|
||||
in between input. This is safe here, since no pipelining is supported.
|
||||
*/
|
||||
ssize_t safe_write(int fd, const void *buf, size_t count);
|
||||
|
||||
#endif /* _SAFE_WRITE_H_ */
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
#ifndef _SUNOS_COMP_H_
|
||||
#define _SUNOS_COMP_H_
|
||||
|
||||
#define socklen_t size_t
|
||||
#define isblank(A) ((A==' ') || (A=='\t'))
|
||||
|
||||
|
||||
#endif /* _SUNOS_COMP_H_ */
|
||||
|
||||
|
269
smmapdfw/install-sh
Executable file
269
smmapdfw/install-sh
Executable file
@ -0,0 +1,269 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
#
|
||||
# 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. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# 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 $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
5
smmapdfw/libsmmapdfw/Makefile.am
Normal file
5
smmapdfw/libsmmapdfw/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h stats.h htcache.h
|
||||
lib_LTLIBRARIES = libsmmapdfw.la
|
||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c htcache.c
|
||||
libsmmapdfw_la_LIBADD = @BDB_LIBS@
|
||||
|
382
smmapdfw/libsmmapdfw/Makefile.in
Normal file
382
smmapdfw/libsmmapdfw/Makefile.in
Normal file
@ -0,0 +1,382 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h stats.h htcache.h
|
||||
lib_LTLIBRARIES = libsmmapdfw.la
|
||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c htcache.c
|
||||
libsmmapdfw_la_LIBADD = @BDB_LIBS@
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libsmmapdfw_la_LDFLAGS =
|
||||
libsmmapdfw_la_DEPENDENCIES =
|
||||
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
|
||||
config_public.lo htdns.lo smtp.lo htmalloc.lo stats.lo htcache.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
|
||||
.deps/htcache.P .deps/htdns.P .deps/htmalloc.P .deps/queue.P \
|
||||
.deps/safe_write.P .deps/smtp.P .deps/stats.P
|
||||
SOURCES = $(libsmmapdfw_la_SOURCES)
|
||||
OBJECTS = $(libsmmapdfw_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu libsmmapdfw/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libsmmapdfw.la: $(libsmmapdfw_la_OBJECTS) $(libsmmapdfw_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libsmmapdfw_la_LDFLAGS) $(libsmmapdfw_la_OBJECTS) $(libsmmapdfw_la_LIBADD) $(LIBS)
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP))
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = libsmmapdfw
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu libsmmapdfw/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-depend \
|
||||
distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool uninstall-includeHEADERS \
|
||||
install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
|
||||
clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -1,13 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
#include "config.h"
|
||||
This file is part of smmapdfw.
|
||||
|
||||
#ifdef SUNOS
|
||||
#include "sunos_comp.h"
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#include "cfg.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
#include "sunos_comp.h"
|
||||
|
||||
#define LF 10
|
||||
|
||||
#define STATE_START 0
|
||||
@ -36,7 +69,7 @@ config_section_t *readcfg(char *cfgfile) {
|
||||
|
||||
f = fopen(cfgfile, "r");
|
||||
if (NULL == f) {
|
||||
syslog(LOG_ERR, "readcfg: unable to open config file");
|
||||
syslog(LOG_ERR, "readcfg: unable to open config file %s", cfgfile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -71,9 +104,9 @@ config_section_t *readcfg(char *cfgfile) {
|
||||
state = STATE_START;
|
||||
i = 0;
|
||||
|
||||
cs = (config_section_t*) malloc(sizeof(config_section_t));
|
||||
cs = (config_section_t*) htmalloc(sizeof(config_section_t));
|
||||
cs->next = NULL;
|
||||
cs->name = (char*) malloc(strlen(buffer)+1);
|
||||
cs->name = (char*) htmalloc(strlen(buffer)+1);
|
||||
strcpy(cs->name, buffer);
|
||||
cs->item = NULL;
|
||||
|
||||
@ -103,9 +136,9 @@ config_section_t *readcfg(char *cfgfile) {
|
||||
state = STATE_EQUAL;
|
||||
i = 0;
|
||||
|
||||
ci = (config_item_t*) malloc(sizeof(config_item_t));
|
||||
ci = (config_item_t*) htmalloc(sizeof(config_item_t));
|
||||
ci->next = NULL;
|
||||
ci->name = (char*) malloc(strlen(buffer)+1);
|
||||
ci->name = (char*) htmalloc(strlen(buffer)+1);
|
||||
strcpy(ci->name, buffer);
|
||||
ci->value = NULL;
|
||||
|
||||
@ -162,7 +195,7 @@ config_section_t *readcfg(char *cfgfile) {
|
||||
state = STATE_START;
|
||||
i = 0;
|
||||
|
||||
ci->value = (char*) malloc(strlen(buffer)+1);
|
||||
ci->value = (char*) htmalloc(strlen(buffer)+1);
|
||||
strcpy(ci->value, buffer);
|
||||
|
||||
break;
|
@ -1,3 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
46
smmapdfw/libsmmapdfw/config_public.c
Normal file
46
smmapdfw/libsmmapdfw/config_public.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "cfg.h"
|
||||
|
||||
char *findcfgl(config_item_t *cfg, char *name) {
|
||||
config_item_t *ci;
|
||||
|
||||
for (ci = cfg; ci != NULL; ci = ci->next)
|
||||
if (0 == strcmp(name, ci->name))
|
||||
return ci->value;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *findcfglx(config_item_t *cfg, char *name, char *default_value) {
|
||||
char *r = findcfgl(cfg, name);
|
||||
return (NULL != r) ? r : default_value;
|
||||
}
|
||||
|
40
smmapdfw/libsmmapdfw/containers_public.h
Normal file
40
smmapdfw/libsmmapdfw/containers_public.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CONTAINERS_PUBLIC_H_
|
||||
#define _CONTAINERS_PUBLIC_H_
|
||||
|
||||
#include "cfg.h"
|
||||
|
||||
struct class_descriptor_s {
|
||||
char *name;
|
||||
int (*init_function)(cfgl_t *cfg, void **handle);
|
||||
int (*destroy_function)(void *handle);
|
||||
int (*work_setup_function)(void *handle, void **work_handle);
|
||||
int (*work_function)(void *handle, void *work_handle, char *input, char *output);
|
||||
int (*work_destroy_function)(void *handle, void *work_handle);
|
||||
};
|
||||
|
||||
typedef struct class_descriptor_s class_descriptor_t;
|
||||
|
||||
|
||||
|
||||
#endif /* _CONTAINERS_PUBLIC_H_ */
|
63
smmapdfw/libsmmapdfw/count.c
Normal file
63
smmapdfw/libsmmapdfw/count.c
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "count.h"
|
||||
|
||||
void count_init(count_t *c) {
|
||||
c->cnt = 0;
|
||||
|
||||
pthread_mutex_init(&c->mutex, NULL);
|
||||
}
|
||||
|
||||
void count_destroy(count_t *c) {
|
||||
pthread_mutex_destroy(&c->mutex);
|
||||
}
|
||||
|
||||
int count_inc(count_t *c) {
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&c->mutex);
|
||||
i = ++c->cnt;
|
||||
pthread_mutex_unlock(&c->mutex);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int count_dec(count_t *c) {
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&c->mutex);
|
||||
i = --c->cnt;
|
||||
pthread_mutex_unlock(&c->mutex);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int count_get(count_t *c) {
|
||||
int i;
|
||||
|
||||
pthread_mutex_lock(&c->mutex);
|
||||
i = c->cnt;
|
||||
pthread_mutex_unlock(&c->mutex);
|
||||
|
||||
return i;
|
||||
}
|
43
smmapdfw/libsmmapdfw/count.h
Normal file
43
smmapdfw/libsmmapdfw/count.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _COUNT_H_
|
||||
#define _COUNT_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct count_s {
|
||||
int cnt;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
typedef struct count_s count_t;
|
||||
|
||||
void count_init(count_t *c);
|
||||
void count_destroy(count_t *c);
|
||||
int count_inc(count_t *c);
|
||||
int count_dec(count_t *c);
|
||||
int count_get(count_t *c);
|
||||
|
||||
#endif /* _COUNT_H_ */
|
||||
|
||||
|
174
smmapdfw/libsmmapdfw/htcache.c
Normal file
174
smmapdfw/libsmmapdfw/htcache.c
Normal file
@ -0,0 +1,174 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if ENABLE_CACHE == 1
|
||||
#define DB_DBM_HSEARCH 1
|
||||
#include <db.h>
|
||||
#endif
|
||||
|
||||
#include "htcache.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
struct mydata_s {
|
||||
time_t timestamp;
|
||||
int value_size;
|
||||
char value[1];
|
||||
};
|
||||
|
||||
typedef struct mydata_s mydata_t;
|
||||
|
||||
|
||||
|
||||
htcache_t *cache_init(const char *file, int expiry) {
|
||||
#if ENABLE_CACHE == 1
|
||||
htcache_t *handle = (htcache_t*) htmalloc(sizeof(htcache_t));
|
||||
handle->mutex = (pthread_mutex_t*) htmalloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(handle->mutex, NULL);
|
||||
pthread_mutex_unlock(handle->mutex);
|
||||
handle->file = file;
|
||||
handle->expiry = expiry;
|
||||
|
||||
return handle;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void cache_destroy(htcache_t *handle) {
|
||||
#if ENABLE_CACHE == 1
|
||||
pthread_mutex_destroy(handle->mutex);
|
||||
free(handle->mutex);
|
||||
free(handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
void cache_insert(htcache_t *handle, const char *key, const void *value, int value_size) {
|
||||
#if ENABLE_CACHE == 1
|
||||
DBM *cache;
|
||||
datum data, dkey;
|
||||
int ret;
|
||||
mydata_t *mydata;
|
||||
|
||||
syslog(LOG_DEBUG, "cache_insert: inserting %s -> %s (size %d)", key, (char*) value, value_size);
|
||||
dkey.dsize = strlen(key) + 1; /* one more for the terminating \0 */
|
||||
dkey.dptr = (char*) key;
|
||||
data.dsize = (sizeof(mydata_t) + value_size + 1);
|
||||
mydata = (mydata_t *) htmalloc(data.dsize);
|
||||
mydata->timestamp = time(NULL);
|
||||
mydata->value_size = value_size;
|
||||
memcpy(mydata->value, value, value_size);
|
||||
data.dptr = (char*) mydata;
|
||||
|
||||
pthread_mutex_lock(handle->mutex);
|
||||
if (NULL != (cache = dbm_open(handle->file, O_RDWR | O_CREAT, 0644))) {
|
||||
ret = dbm_store(cache, dkey, data, DBM_INSERT);
|
||||
if (ret != 0) {
|
||||
syslog(LOG_DEBUG, "cache_insert: couldn't insert record");
|
||||
} else {
|
||||
syslog(LOG_DEBUG, "cache_insert: record inserted");
|
||||
}
|
||||
dbm_close(cache);
|
||||
}
|
||||
pthread_mutex_unlock(handle->mutex);
|
||||
|
||||
free(mydata);
|
||||
#else
|
||||
syslog(LOG_DEBUG, "cache_insert: cache disabled");
|
||||
#endif /* ENABLE_CACHE */
|
||||
}
|
||||
|
||||
|
||||
void *cache_lookup(htcache_t *handle, const char* key) {
|
||||
#if ENABLE_CACHE == 1
|
||||
DBM *cache;
|
||||
datum data, dkey;
|
||||
char *output;
|
||||
mydata_t *mydata;
|
||||
int value_size, ret, res = -1;
|
||||
|
||||
syslog(LOG_DEBUG, "cache_lookup: looking up %s, expiry %d",
|
||||
key, handle->expiry);
|
||||
|
||||
if (NULL != (cache = dbm_open(handle->file, O_RDONLY, 0644))) {
|
||||
dkey.dsize = strlen(key) + 1; /* one more for the terminating \0 */
|
||||
dkey.dptr = (char*) key;
|
||||
data = dbm_fetch(cache, dkey);
|
||||
if (NULL == data.dptr) {
|
||||
syslog(LOG_DEBUG, "cache_lookup: nothing found");
|
||||
dbm_close(cache);
|
||||
} else {
|
||||
mydata = (mydata_t *) data.dptr;
|
||||
syslog(LOG_DEBUG, "cache_lookup: found: %s -> %s (size %d)",
|
||||
key, data.dptr, data.dsize);
|
||||
if ((mydata->timestamp + handle->expiry) > time(NULL)) {
|
||||
syslog(LOG_DEBUG, "cache_lookup: not yet expired");
|
||||
value_size = mydata->value_size;
|
||||
output = (char*) htmalloc(value_size+5);
|
||||
memcpy(output, mydata->value, value_size);
|
||||
|
||||
/* Berkeley DB frees on its own! */
|
||||
/* free(data.dptr); */
|
||||
dbm_close(cache);
|
||||
res = 0;
|
||||
} else {
|
||||
syslog(LOG_DEBUG, "cache_lookup: expired, will be deleted from cache");
|
||||
/* free(data.dptr); --- Berkeley DB frees on its own */
|
||||
dbm_close(cache);
|
||||
|
||||
pthread_mutex_lock(handle->mutex);
|
||||
if (NULL != (cache = dbm_open(handle->file, O_RDWR, 0644))) {
|
||||
ret = dbm_delete(cache, dkey);
|
||||
if (ret != 0) {
|
||||
syslog(LOG_DEBUG, "cache_insert: couldn't delete record");
|
||||
} else {
|
||||
syslog(LOG_DEBUG, "cache_insert: record deleted");
|
||||
}
|
||||
dbm_close(cache);
|
||||
}
|
||||
pthread_mutex_unlock(handle->mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
#else
|
||||
return -1;
|
||||
#endif /* ENABLE_CACHE */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
43
smmapdfw/libsmmapdfw/htcache.h
Normal file
43
smmapdfw/libsmmapdfw/htcache.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _HTCACHE_H_
|
||||
#define _HTCACHE_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
typedef struct htcache_s {
|
||||
const char *file;
|
||||
int expiry;
|
||||
pthread_mutex_t *mutex;
|
||||
} htcache_t;
|
||||
|
||||
htcache_t *cache_init(const char *file, int expiry);
|
||||
void cache_destroy(htcache_t *handle);
|
||||
void cache_insert(htcache_t *handle, const char *key, const void *value, int value_size);
|
||||
void *cache_lookup(htcache_t *handle, const char *key);
|
||||
|
||||
|
||||
#endif /* _HTCACHE_H_ */
|
||||
|
||||
|
@ -1,18 +1,52 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <resolv.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "dns.h"
|
||||
#if HAVE_LIBDJBDNS
|
||||
#include <dns.h>
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#include <resolv.h>
|
||||
#endif
|
||||
|
||||
#include "htdns.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
#if ! HAVE_LIBDJBDNS
|
||||
extern int h_errno;
|
||||
/* extern struct state _res; */
|
||||
#endif
|
||||
|
||||
union answer_u {
|
||||
HEADER hdr;
|
||||
@ -28,19 +62,27 @@ typedef union answer_u answer_t;
|
||||
#define get16(b, o) ((b[o] << 8) + b[o+1])
|
||||
|
||||
|
||||
#if HAVE_LIBDJBDNS
|
||||
pthread_mutex_t dns_transmit_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
static int get_domain_name(answer_t *answer, int offset, char **name) {
|
||||
int start, len, i, offset2;
|
||||
char *name_buf, *name_buf2;
|
||||
char *name_buf, *name_buf2, *remember_name_buf;
|
||||
name_buf = NULL;
|
||||
|
||||
|
||||
|
||||
while (0 != (len = answer->buf[offset++])) {
|
||||
if (0xC0 == (len & 0xC0)) {
|
||||
if (NULL != name) { /* if we don't need the result, we don't need to recurse, since a ... */
|
||||
offset2 = ((len & ~0xC0) << 8) + answer->buf[offset++];
|
||||
get_domain_name(answer, offset2, &name_buf2);
|
||||
name_buf = (char*) realloc(name_buf, ((NULL != name_buf) ? strlen(name_buf) : 0) + strlen(name_buf2) + 1);
|
||||
remember_name_buf = name_buf;
|
||||
name_buf = (char*) htrealloc(name_buf, ((NULL != name_buf) ? strlen(name_buf) : 0) + strlen(name_buf2) + 1);
|
||||
if (NULL == remember_name_buf) {
|
||||
name_buf[0] = '\0';
|
||||
}
|
||||
strcat(name_buf, name_buf2);
|
||||
free(name_buf2);
|
||||
*name = name_buf;
|
||||
@ -53,7 +95,7 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
||||
offset += len;
|
||||
if (NULL != name) {
|
||||
i = (NULL != name_buf) ? strlen(name_buf) : 0;
|
||||
name_buf = (char*) realloc(name_buf, i+len+2);
|
||||
name_buf = (char*) htrealloc(name_buf, i+len+2);
|
||||
strncpy(name_buf + i, answer->buf + start, len);
|
||||
name_buf[i+len] = '\0';
|
||||
strcat(name_buf, ".");
|
||||
@ -68,7 +110,7 @@ static int get_domain_name(answer_t *answer, int offset, char **name) {
|
||||
}
|
||||
|
||||
static int get_mx_rdata(answer_t *answer, int offset, int len, mx_rdata_t **resp) {
|
||||
*resp = (mx_rdata_t*) malloc(sizeof(mx_rdata_t));
|
||||
*resp = (mx_rdata_t*) htmalloc(sizeof(mx_rdata_t));
|
||||
(*resp)->preference = get16(answer->buf, offset);
|
||||
get_domain_name(answer, offset+2, &(*resp)->exchange);
|
||||
(*resp)->type = T_MX;
|
||||
@ -84,13 +126,27 @@ static void free_mx_rdata(mx_rdata_t *resp) {
|
||||
|
||||
|
||||
static int get_a_rdata(answer_t *answer, int offset, int len, a_rdata_t **resp) {
|
||||
*resp = (a_rdata_t*) malloc(sizeof(a_rdata_t));
|
||||
*resp = (a_rdata_t*) htmalloc(sizeof(a_rdata_t));
|
||||
(*resp)->address = htonl(get32(answer->buf, offset));
|
||||
(*resp)->type = T_A;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_cname_rdata(answer_t *answer, int offset, int len, cname_rdata_t **resp) {
|
||||
*resp = (cname_rdata_t*) htmalloc(sizeof(cname_rdata_t));
|
||||
get_domain_name(answer, offset, &(*resp)->cname);
|
||||
(*resp)->type = T_CNAME;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_cname_rdata(cname_rdata_t *resp) {
|
||||
free(resp->cname);
|
||||
free(resp);
|
||||
}
|
||||
|
||||
|
||||
static void free_a_rdata(a_rdata_t *resp) {
|
||||
free(resp);
|
||||
}
|
||||
@ -103,6 +159,9 @@ static int get_rdata(answer_t *answer, int type, int offset, int len, void **res
|
||||
case T_A:
|
||||
get_a_rdata(answer, offset, len, (a_rdata_t**)resp);
|
||||
break;
|
||||
case T_CNAME:
|
||||
get_cname_rdata(answer, offset, len, (cname_rdata_t**)resp);
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_ERR, "type %d unsupported\n", type);
|
||||
}
|
||||
@ -118,6 +177,9 @@ static void free_rdata(void *resp) {
|
||||
case T_A:
|
||||
free_a_rdata(resp);
|
||||
break;
|
||||
case T_CNAME:
|
||||
free_cname_rdata(resp);
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_ERR, "type %d unsupported\n", d->type);
|
||||
}
|
||||
@ -135,51 +197,155 @@ void free_rrs(void **resp) {
|
||||
|
||||
static void** get_rrs(char *domain, int qtype) {
|
||||
unsigned int res, i, cnt, len, offset, x, y, rdlength;
|
||||
answer_t answer;
|
||||
answer_t *answer;
|
||||
unsigned int class, type, ttl;
|
||||
char *name;
|
||||
void **rdata, **rdata2;
|
||||
|
||||
#if HAVE_LIBDJBDNS
|
||||
struct dns_transmit dt = {0};
|
||||
#endif
|
||||
|
||||
|
||||
syslog(LOG_DEBUG, "get_rrs: looking up domain %s, qtype %d", domain, qtype);
|
||||
|
||||
res = res_search(domain, C_IN, qtype, (u_char*) &answer, sizeof(answer_t));
|
||||
if (-1 == res) {
|
||||
return NULL;
|
||||
#if HAVE_LIBDJBDNS
|
||||
{
|
||||
char s[64];
|
||||
int flagrecursive = 1;
|
||||
char *q = NULL;
|
||||
char t[2];
|
||||
char localip[4] = "\0\0\0\0";
|
||||
iopause_fd x[1];
|
||||
struct taia deadline;
|
||||
struct taia stamp;
|
||||
|
||||
|
||||
t[0] = '\0';
|
||||
t[1] = qtype;
|
||||
|
||||
if (dns_resolvconfip(s) == -1) {
|
||||
syslog(LOG_ERR, "failure in dns_resolvconfip: %d, %s\n",
|
||||
errno, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dns_domain_fromdot(&q, domain, strlen(domain));
|
||||
|
||||
pthread_mutex_lock(&dns_transmit_mutex);
|
||||
res = dns_transmit_start(&dt, s, flagrecursive, q, t, localip);
|
||||
pthread_mutex_unlock(&dns_transmit_mutex);
|
||||
|
||||
if (res == -1) {
|
||||
syslog(LOG_ERR, "failure in dns_transmit_start: %d, %s\n",
|
||||
errno, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
int r;
|
||||
|
||||
taia_now(&stamp);
|
||||
taia_uint(&deadline,120);
|
||||
taia_add(&deadline, &deadline, &stamp);
|
||||
pthread_mutex_lock(&dns_transmit_mutex);
|
||||
dns_transmit_io(&dt, x, &deadline);
|
||||
pthread_mutex_unlock(&dns_transmit_mutex);
|
||||
|
||||
iopause(x, 1, &deadline, &stamp);
|
||||
|
||||
pthread_mutex_lock(&dns_transmit_mutex);
|
||||
r = dns_transmit_get(&dt, x, &stamp);
|
||||
pthread_mutex_unlock(&dns_transmit_mutex);
|
||||
|
||||
if (-1 == r) {
|
||||
syslog(LOG_ERR, "failure in dns_transmit_get: %d, %s\n",
|
||||
errno, strerror(errno));
|
||||
|
||||
pthread_mutex_lock(&dns_transmit_mutex);
|
||||
dns_transmit_free(&dt);
|
||||
pthread_mutex_unlock(&dns_transmit_mutex);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (1 == r)
|
||||
break;
|
||||
}
|
||||
|
||||
answer = (answer_t*) dt.packet;
|
||||
}
|
||||
#else
|
||||
{
|
||||
answer_t lanswer;
|
||||
|
||||
syslog(LOG_DEBUG, "get_rrs: before res_search");
|
||||
res = res_search(domain, C_IN, qtype, (u_char*) &lanswer, sizeof(answer_t));
|
||||
if (-1 == res) {
|
||||
syslog(LOG_ERR, "get_rrs: error in res_search: h_errno=%d, errno=%d, (%s)",
|
||||
h_errno, errno, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
answer = &lanswer;
|
||||
}
|
||||
#endif
|
||||
|
||||
cnt = sizeof(HEADER);
|
||||
|
||||
#if 0
|
||||
syslog(LOG_DEBUG, "id: %d\n", answer->hdr.id);
|
||||
syslog(LOG_DEBUG, "qr: %d\n", answer->hdr.qr);
|
||||
syslog(LOG_DEBUG, "oc: %d\n", answer->hdr.opcode);
|
||||
syslog(LOG_DEBUG, "aa: %d\n", answer->hdr.aa);
|
||||
syslog(LOG_DEBUG, "tc: %d\n", answer->hdr.tc);
|
||||
syslog(LOG_DEBUG, "rd: %d\n", answer->hdr.rd);
|
||||
syslog(LOG_DEBUG, "ra: %d\n", answer->hdr.ra);
|
||||
syslog(LOG_DEBUG, "ad: %d\n", answer->hdr.ad);
|
||||
syslog(LOG_DEBUG, "cd: %d\n", answer->hdr.cd);
|
||||
syslog(LOG_DEBUG, "rc: %d\n", answer->hdr.rcode);
|
||||
syslog(LOG_DEBUG, "qdcount: %d\n", ntohs(answer->hdr.qdcount));
|
||||
syslog(LOG_DEBUG, "ancount: %d\n", ntohs(answer->hdr.ancount));
|
||||
syslog(LOG_DEBUG, "nscount: %d\n", ntohs(answer->hdr.nscount));
|
||||
syslog(LOG_DEBUG, "arcount: %d\n", ntohs(answer->hdr.arcount));
|
||||
#endif
|
||||
|
||||
/* query section */
|
||||
for (y = 0; y < ntohs(answer.hdr.qdcount); y++) {
|
||||
cnt = get_domain_name(&answer, cnt, NULL);
|
||||
type = get16(answer.buf, cnt);
|
||||
for (y = 0; y < ntohs(answer->hdr.qdcount); y++) {
|
||||
cnt = get_domain_name(answer, cnt, NULL);
|
||||
type = get16(answer->buf, cnt);
|
||||
cnt += 2;
|
||||
class = get16(answer.buf, cnt);
|
||||
class = get16(answer->buf, cnt);
|
||||
cnt += 2;
|
||||
}
|
||||
|
||||
/* answer section */
|
||||
rdata = (void**)malloc(sizeof(void*) * (ntohs(answer.hdr.ancount)+1));
|
||||
for (y = 0; y < ntohs(answer.hdr.ancount); y++) {
|
||||
cnt = get_domain_name(&answer, cnt, NULL);
|
||||
type = get16(answer.buf, cnt);
|
||||
assert(type==qtype);
|
||||
rdata = (void**)htmalloc(sizeof(void*) * (ntohs(answer->hdr.ancount)+1));
|
||||
for (y = 0; y < ntohs(answer->hdr.ancount); y++) {
|
||||
cnt = get_domain_name(answer, cnt, NULL);
|
||||
type = get16(answer->buf, cnt);
|
||||
syslog(LOG_DEBUG, "get_rrs: answer type %d", type);
|
||||
/* assert(type==qtype); */
|
||||
cnt += 2;
|
||||
class = get16(answer.buf, cnt);
|
||||
class = get16(answer->buf, cnt);
|
||||
cnt += 2;
|
||||
ttl = get32(answer.buf, cnt);
|
||||
ttl = get32(answer->buf, cnt);
|
||||
cnt += 4;
|
||||
rdlength = get16(answer.buf, cnt);
|
||||
rdlength = get16(answer->buf, cnt);
|
||||
cnt += 2;
|
||||
rdata2 = rdata+y;
|
||||
get_rdata(&answer, type, cnt, rdlength, rdata2);
|
||||
get_rdata(answer, type, cnt, rdlength, rdata2);
|
||||
cnt += rdlength;
|
||||
}
|
||||
|
||||
rdata2 = rdata+y;
|
||||
*((void**)rdata2) = NULL;
|
||||
|
||||
#if HAVE_LIBDJBDNS
|
||||
pthread_mutex_lock(&dns_transmit_mutex);
|
||||
dns_transmit_free(&dt);
|
||||
pthread_mutex_unlock(&dns_transmit_mutex);
|
||||
#endif
|
||||
|
||||
return rdata;
|
||||
}
|
||||
|
||||
@ -188,7 +354,21 @@ mx_rdata_t** get_mx_rrs(char *domain) {
|
||||
}
|
||||
|
||||
a_rdata_t** get_a_rrs(char *domain) {
|
||||
return (a_rdata_t**) get_rrs(domain, T_A);
|
||||
rdata_t **rdata, **rdata2;
|
||||
cname_rdata_t **cname_rdata;
|
||||
|
||||
rdata = (rdata_t**) get_rrs(domain, T_A);
|
||||
if ((NULL == rdata) || (NULL == *rdata))
|
||||
return NULL;
|
||||
|
||||
if ((*rdata)->type == T_CNAME) {
|
||||
cname_rdata = (cname_rdata_t**) rdata;
|
||||
rdata2 = (rdata_t**) get_a_rrs((*cname_rdata)->cname);
|
||||
free_rrs((void**)rdata);
|
||||
rdata = rdata2;
|
||||
}
|
||||
|
||||
return (a_rdata_t**) rdata;
|
||||
}
|
||||
|
||||
|
||||
@ -223,7 +403,7 @@ mx_rdata_t** get_best_mx_rrs(char *domain) {
|
||||
return all_mx_rrs;
|
||||
} else {
|
||||
/* space for the minimum pref rr's */
|
||||
best_mx_rrs = (mx_rdata_t**) malloc(sizeof(mx_rdata_t*) * (best_cnt+1));
|
||||
best_mx_rrs = (mx_rdata_t**) htmalloc(sizeof(mx_rdata_t*) * (best_cnt+1));
|
||||
for (mx_rdata2 = all_mx_rrs; *mx_rdata2 != NULL; mx_rdata2++) {
|
||||
if ((*mx_rdata2)->preference == min_pref) {
|
||||
/* is a minimum one, keep it */
|
||||
@ -262,6 +442,9 @@ int main(int argc, char **argv) {
|
||||
domain = argv[1];
|
||||
}
|
||||
|
||||
openlog("htdns-test", LOG_PID, LOG_LOCAL2);
|
||||
|
||||
|
||||
printf("before get_mx_rrs: %s\n", domain);
|
||||
|
||||
mx_rdata = get_mx_rrs(domain);
|
||||
@ -303,6 +486,8 @@ int main(int argc, char **argv) {
|
||||
/* free_rrs((void**)a_rdata); */
|
||||
|
||||
|
||||
|
||||
closelog();
|
||||
}
|
||||
|
||||
#endif /* _TEST_MODE_ */
|
70
smmapdfw/libsmmapdfw/htdns.h
Normal file
70
smmapdfw/libsmmapdfw/htdns.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _DNS_H_
|
||||
#define _DNS_H_
|
||||
|
||||
struct mx_rdata_s {
|
||||
int type;
|
||||
int preference;
|
||||
char *exchange;
|
||||
};
|
||||
|
||||
typedef struct mx_rdata_s mx_rdata_t;
|
||||
|
||||
struct cname_rdata_s {
|
||||
int type;
|
||||
char *cname;
|
||||
};
|
||||
|
||||
typedef struct cname_rdata_s cname_rdata_t;
|
||||
|
||||
struct a_rdata_s {
|
||||
int type;
|
||||
unsigned int address;
|
||||
};
|
||||
|
||||
typedef struct a_rdata_s a_rdata_t;
|
||||
|
||||
struct rdata_s {
|
||||
int type;
|
||||
union {
|
||||
mx_rdata_t mx;
|
||||
a_rdata_t a;
|
||||
cname_rdata_t cname;
|
||||
} data;
|
||||
};
|
||||
|
||||
typedef struct rdata_s rdata_t;
|
||||
|
||||
|
||||
void free_rrs(void **resp);
|
||||
mx_rdata_t** get_mx_rrs(char *domain);
|
||||
mx_rdata_t** get_best_mx_rrs(char *domain);
|
||||
a_rdata_t** get_a_rrs(char *domain);
|
||||
cname_rdata_t** get_cname_rrs(char *domain);
|
||||
|
||||
|
||||
|
||||
#endif /* _DNS_H_ */
|
||||
|
||||
|
56
smmapdfw/libsmmapdfw/htmalloc.c
Normal file
56
smmapdfw/libsmmapdfw/htmalloc.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
void *htmalloc(size_t size) {
|
||||
void *p = malloc(size);
|
||||
if (NULL == p) {
|
||||
syslog(LOG_ERR, "htmalloc: out of memory");
|
||||
exit(153);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void *htrealloc(void *ptr, size_t size) {
|
||||
void *p = realloc(ptr, size);
|
||||
if (NULL == p) {
|
||||
syslog(LOG_ERR, "htremalloc: out of memory");
|
||||
exit(153);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
char *htstrdup(const char *s) {
|
||||
char *p = htmalloc(strlen(s) + 1);
|
||||
strcpy(p, s);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
34
smmapdfw/libsmmapdfw/htmalloc.h
Normal file
34
smmapdfw/libsmmapdfw/htmalloc.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _HTMALLOC_H_
|
||||
#define _HTMALLOC_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void *htmalloc(size_t size);
|
||||
void *htrealloc(void *ptr, size_t size);
|
||||
char *htstrdup(const char *s);
|
||||
|
||||
|
||||
|
||||
#endif /* _HTMALLOC_H_ */
|
||||
|
||||
|
@ -1,4 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "queue.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
#ifdef _TEST_MODE_
|
||||
#include <stdio.h>
|
||||
@ -23,7 +46,7 @@ void queue_destroy(ht_queue_t *q) {
|
||||
int queue_put(ht_queue_t *q, void *d) {
|
||||
queue_entry_t *entry;
|
||||
|
||||
entry = (queue_entry_t *) malloc(sizeof(queue_entry_t));
|
||||
entry = (queue_entry_t *) htmalloc(sizeof(queue_entry_t));
|
||||
if (NULL == entry)
|
||||
return -1;
|
||||
|
51
smmapdfw/libsmmapdfw/queue.h
Normal file
51
smmapdfw/libsmmapdfw/queue.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _QUEUE_H_
|
||||
#define _QUEUE_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct queue_entry_s {
|
||||
void *data;
|
||||
struct queue_entry_s *next;
|
||||
struct queue_entry_s *prev;
|
||||
};
|
||||
|
||||
typedef struct queue_entry_s queue_entry_t;
|
||||
|
||||
struct queue_s {
|
||||
queue_entry_t *tail;
|
||||
queue_entry_t *head;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
typedef struct queue_s ht_queue_t;
|
||||
|
||||
void queue_init(ht_queue_t *q);
|
||||
void queue_destroy(ht_queue_t *q);
|
||||
int queue_put(ht_queue_t *q, void *d);
|
||||
void *queue_get_wait(ht_queue_t *q);
|
||||
|
||||
|
||||
#endif /* _QUEUE_H_ */
|
||||
|
||||
|
@ -1,3 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <syslog.h>
|
||||
#include <sys/select.h>
|
||||
#include <errno.h>
|
37
smmapdfw/libsmmapdfw/safe_write.h
Normal file
37
smmapdfw/libsmmapdfw/safe_write.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SAFE_WRITE_H_
|
||||
#define _SAFE_WRITE_H_
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#define _SAFE_WRITE_READ_BUF_SIZE 256
|
||||
|
||||
|
||||
/* _safe_write avoids SIGPIPE when writing but it skips a part of an possible
|
||||
in between input. This is safe here, since no pipelining is supported.
|
||||
*/
|
||||
ssize_t safe_write(int fd, const void *buf, size_t count);
|
||||
|
||||
#endif /* _SAFE_WRITE_H_ */
|
||||
|
||||
|
@ -1,3 +1,25 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/types.h>
|
||||
@ -12,7 +34,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "smtp.h"
|
||||
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
#define BUFSIZE 1024
|
||||
@ -21,7 +43,7 @@
|
||||
|
||||
|
||||
smtp_t *smtp_init(unsigned int address, int port, int timeout) {
|
||||
smtp_t *handle = (smtp_t*) malloc(sizeof(smtp_t));
|
||||
smtp_t *handle = (smtp_t*) htmalloc(sizeof(smtp_t));
|
||||
|
||||
handle->address = address;
|
||||
handle->port = port;
|
||||
@ -30,7 +52,7 @@ smtp_t *smtp_init(unsigned int address, int port, int timeout) {
|
||||
handle->response_code = 0;
|
||||
handle->got_timeout = 0;
|
||||
|
||||
handle->buffer = (char*) malloc(BUFSIZE+5);
|
||||
handle->buffer = (char*) htmalloc(BUFSIZE+5);
|
||||
|
||||
return handle;
|
||||
}
|
||||
@ -196,9 +218,7 @@ int smtp_command(smtp_t *handle, char *command, char *arg) {
|
||||
}
|
||||
|
||||
int smtp_connect(smtp_t *handle) {
|
||||
int err;
|
||||
int c;
|
||||
int res;
|
||||
int err, c, res, optval;
|
||||
fd_set wrfs;
|
||||
struct timeval tv;
|
||||
|
||||
@ -209,6 +229,13 @@ int smtp_connect(smtp_t *handle) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
optval = 0x10; /* TOS=lowdelay*/
|
||||
err = setsockopt(handle->socket, IPPROTO_IP, IP_TOS, (void*)&optval, sizeof(optval));
|
||||
if (-1 == err) {
|
||||
syslog(LOG_DEBUG, "smtp_connect: unable to set IPTOS_LOWDELAY: %d (%s)", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = fcntl(handle->socket, F_GETFL);
|
||||
if (-1 == c) {
|
||||
syslog(LOG_DEBUG, "smtp_connect: unable to get flags, errno: %d (%s)", errno, strerror(errno));
|
@ -1,3 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SMTP_H_
|
||||
#define _SMTP_H_
|
||||
|
106
smmapdfw/libsmmapdfw/stats.c
Normal file
106
smmapdfw/libsmmapdfw/stats.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define _STATS_C_
|
||||
#include "stats.h"
|
||||
|
||||
#include "count.h"
|
||||
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
count_t statCounter[STAT_CNT_MAXNUM];
|
||||
#endif
|
||||
|
||||
void initStatCounter() {
|
||||
#if ENABLE_STATS==1
|
||||
int i;
|
||||
|
||||
for (i=0; i<STAT_CNT_MAXNUM; i++) {
|
||||
count_init(&statCounter[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int getStatCounter(int cnt_idx) {
|
||||
#if ENABLE_STATS==1
|
||||
assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM));
|
||||
return count_get(&statCounter[cnt_idx]);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void incStatCounter(int cnt_idx) {
|
||||
#if ENABLE_STATS==1
|
||||
assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM));
|
||||
count_inc(&statCounter[cnt_idx]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void decStatCounter(int cnt_idx) {
|
||||
#if ENABLE_STATS==1
|
||||
assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM));
|
||||
count_dec(&statCounter[cnt_idx]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void outputStats(int stdout_nice, int syslog_nice) {
|
||||
#if ENABLE_STATS==1
|
||||
char buf[1024];
|
||||
char buf2[64];
|
||||
int i, v;
|
||||
|
||||
*buf = '\0';
|
||||
*buf2 = '\0';
|
||||
|
||||
strcat(buf, "Stats: ");
|
||||
|
||||
if (2 == stdout_nice)
|
||||
printf("---------------------------------------------------------\n");
|
||||
|
||||
for (i=1; i<STAT_CNT_MAXNUM; i++) {
|
||||
v = getStatCounter(i);
|
||||
if (2 == stdout_nice)
|
||||
printf("%44s = %5d\n", stat_cnt_names[i], v);
|
||||
if (2 == syslog_nice)
|
||||
syslog(LOG_DEBUG, "%44s = %5d\n", stat_cnt_names[i], v);
|
||||
if ((1 == stdout_nice) || (1 == syslog_nice)) {
|
||||
sprintf(buf2, "%d ", v);
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
}
|
||||
|
||||
if (stdout_nice)
|
||||
printf("\n");
|
||||
|
||||
if (1 == stdout_nice)
|
||||
printf("%s\n\n", buf);
|
||||
if (1 == syslog_nice)
|
||||
syslog(LOG_DEBUG, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
103
smmapdfw/libsmmapdfw/stats.h
Normal file
103
smmapdfw/libsmmapdfw/stats.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _STATS_H_
|
||||
#define _STATS_H_
|
||||
|
||||
#include "smmapd.h"
|
||||
|
||||
#ifdef _STATS_C_
|
||||
char *stat_cnt_names[] = {
|
||||
"",
|
||||
"Server: accepted",
|
||||
"Server: failed",
|
||||
"Server: running networker threads",
|
||||
"Server: networker threads",
|
||||
"Server: failed to start, networker threads",
|
||||
|
||||
"Verifier: entries in cache",
|
||||
"Verifier: running worker threads",
|
||||
"Verifier: worker threads",
|
||||
"Verifier: failed to start, worker threads",
|
||||
"Verifier: timed out worker threads",
|
||||
"Verifier: running checker threads",
|
||||
"Verifier: checker threads",
|
||||
"Verifier: failed to start, checker threads",
|
||||
"Verifier: answered from cache",
|
||||
"Verifier: returned OK",
|
||||
"Verifier: returned NOK",
|
||||
"Verifier: returned TNOK",
|
||||
|
||||
"Cyrus: checker",
|
||||
"Cyrus: illegal input",
|
||||
"Cyrus: depot dns failure",
|
||||
"Cyrus: returned OK",
|
||||
"Cyrus: returned NOK",
|
||||
"Cyrus: returned TNOK",
|
||||
|
||||
"Server: returned OK",
|
||||
"Server: returned TEMP_NOK",
|
||||
"Server: returned PERM_NOK",
|
||||
"Server: returned NOT_FOUND_NOK",
|
||||
"Server: returned illegal input",
|
||||
"Server: returned unknown class",
|
||||
"Server: returned TIMEOUT_NOK",
|
||||
"Server: returned netstring unparsable",
|
||||
};
|
||||
#endif /* _STATS_C_ */
|
||||
|
||||
|
||||
#define STAT_CNT_ACCEPTED 1
|
||||
#define STAT_CNT_FAILED 2
|
||||
#define STAT_CNT_NETWORKER_R_THREADS 3
|
||||
#define STAT_CNT_NETWORKER_THREADS 4
|
||||
#define STAT_CNT_NETWORKER_THREADS_FAILED 5
|
||||
|
||||
#define STAT_CNT_VERIFIER_CACHE 6
|
||||
#define STAT_CNT_VERIFIER_WORKER_R_THREADS 7
|
||||
#define STAT_CNT_VERIFIER_WORKER_THREADS 8
|
||||
#define STAT_CNT_VERIFIER_WORKER_THREADS_FAILED 9
|
||||
#define STAT_CNT_VERIFIER_WORKER_THREADS_TIMEOUT 10
|
||||
#define STAT_CNT_VERIFIER_CHECKER_R_THREADS 11
|
||||
#define STAT_CNT_VERIFIER_CHECKER_THREADS 12
|
||||
#define STAT_CNT_VERIFIER_CHECKER_THREADS_FAILED 13
|
||||
#define STAT_CNT_VERIFIER_ANSWERED_FROM_CACHE 14
|
||||
#define STAT_CNT_VERIFIER_RETURNED_OK 15
|
||||
#define STAT_CNT_VERIFIER_RETURNED_NOK 16
|
||||
#define STAT_CNT_VERIFIER_RETURNED_TNOK 17
|
||||
|
||||
#define STAT_CNT_CYRUS_WORKER 18
|
||||
#define STAT_CNT_CYRUS_ILLEGAL_INPUT 19
|
||||
#define STAT_CNT_CYRUS_DEPOT_DNS_FAILURE 20
|
||||
#define STAT_CNT_CYRUS_RETURNED_OK 21
|
||||
#define STAT_CNT_CYRUS_RETURNED_NOK 22
|
||||
#define STAT_CNT_CYRUS_RETURNED_TNOK 23
|
||||
|
||||
#define STAT_CNT_OFFSET 23
|
||||
#define STAT_CNT_MAXNUM STAT_CNT_OFFSET + SMM_MAX_NUM
|
||||
|
||||
|
||||
void initStatCounter();
|
||||
unsigned int getStatCounter(int cnt_idx);
|
||||
void incStatCounter(int cnt_idx);
|
||||
void decStatCounter(int cnt_idx);
|
||||
void outputStats(int stdout_nice, int syslog_nice);
|
||||
#endif /* _STATS_H_ */
|
42
smmapdfw/libsmmapdfw/sunos_comp.h
Normal file
42
smmapdfw/libsmmapdfw/sunos_comp.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SUNOS_COMP_H_
|
||||
#define _SUNOS_COMP_H_
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
#define socklen_t size_t
|
||||
#endif
|
||||
|
||||
#ifndef isblank
|
||||
#define isblank(A) ((A==' ') || (A=='\t'))
|
||||
#endif
|
||||
|
||||
#endif /* _SUNOS_COMP_H_ */
|
||||
|
||||
|
6430
smmapdfw/ltmain.sh
Normal file
6430
smmapdfw/ltmain.sh
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
@ -7,6 +27,7 @@
|
||||
|
||||
#include "containers_public.h"
|
||||
#include "smmapd.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
#define CFG_LUALIB_NAMES "load"
|
||||
@ -67,7 +88,7 @@ int lua_init(cfgl_t *cfg, void **handle) {
|
||||
const luaL_reg *lualib;
|
||||
cfgl_t *cfgl_iter;
|
||||
|
||||
lch = (lua_container_handle_t*) malloc(sizeof(lua_container_handle_t));
|
||||
lch = (lua_container_handle_t*) htmalloc(sizeof(lua_container_handle_t));
|
||||
lch->cfg = cfg;
|
||||
|
||||
lua_filename = findcfgl(lch->cfg, CFG_LUA_FILENAME);
|
||||
@ -145,7 +166,7 @@ int lua_destroy(void *handle) {
|
||||
}
|
||||
|
||||
int lua_work_setup(void *handle, void **work_handle) {
|
||||
lua_worker_handle_t *lwh = (lua_worker_handle_t*)malloc(sizeof(lua_worker_handle_t));
|
||||
lua_worker_handle_t *lwh = (lua_worker_handle_t*)htmalloc(sizeof(lua_worker_handle_t));
|
||||
lwh->lch = (lua_container_handle_t*) handle;
|
||||
|
||||
lwh->l = lua_newthread(lwh->lch->l);
|
2
smmapdfw/m4/Makefile.am
Normal file
2
smmapdfw/m4/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
||||
data_DATA = cyruscheck.m4 verifysender.m4
|
||||
EXTRA_DIST = cyruscheck.m4 verifysender.m4
|
221
smmapdfw/m4/Makefile.in
Normal file
221
smmapdfw/m4/Makefile.in
Normal file
@ -0,0 +1,221 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
data_DATA = cyruscheck.m4 verifysender.m4
|
||||
EXTRA_DIST = cyruscheck.m4 verifysender.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DATA = $(data_DATA)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-dataDATA: $(data_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||
@list='$(data_DATA)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p; \
|
||||
else if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p; \
|
||||
fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-dataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(data_DATA)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(datadir)/$$p; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = m4
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu m4/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-dataDATA
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-dataDATA
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(DATA)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: uninstall-dataDATA install-dataDATA tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -1,3 +1,21 @@
|
||||
dnl Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
dnl
|
||||
dnl This file is part of smmapdfw.
|
||||
dnl
|
||||
dnl smmapdfw is free software; you can redistribute it and/or modify it
|
||||
dnl under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl smmapdfw is distributed in the hope that it will be useful, but WITHOUT
|
||||
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
dnl License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
dnl Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
VERSIONID(`$Id$')
|
||||
|
||||
|
||||
@ -42,7 +60,10 @@ Scc
|
||||
R< $+ > < $+ > $: < $(cyruscheck $1 $2 $:none $) >
|
||||
|
||||
Scyruscheck
|
||||
R< $+ > < $+ > $: < $1 > < $2 > < $(cyruscheck $1 $2 $:none $) >
|
||||
R< $+ > < $+ > $: < $1 > < $2 > < $&f >
|
||||
dnl do not perform check when sender is not set - so only for the recipient
|
||||
R< $+ > < $+ > < > $@ < ok >
|
||||
R< $+ > < $+ > < $+ > $: < $1 > < $2 > < $(cyruscheck $1 $2 $:none $) >
|
||||
ifelse(_dummy_, `dummy', `dnl
|
||||
dnl dummy
|
||||
R< $+ > < $+ > < $+ > $@ < ok > $(cht_logger $1 -- $2 --- $3 $)', `dnl
|
||||
@ -51,4 +72,5 @@ R< $+ > < $+ > < $+ > $: < $3 >
|
||||
R< <OK> $* > $@ < ok >
|
||||
R< <NOK> $* > $#error $@ 5.0.0 $: "500 Depot returns error: " $1
|
||||
R< <TNOK> $* > $#error $@ 4.0.0 $: "400 Depot returns error: " $1
|
||||
R< $* <temp> > $#error $@ 4.0.0 $: "400 Currently not verification possible, try again later"
|
||||
R$* $#error $@ 4.7.1 $: "451 Local configuration error <cc1>"')
|
||||
|
@ -1,3 +1,21 @@
|
||||
dnl Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
dnl
|
||||
dnl This file is part of smmapdfw.
|
||||
dnl
|
||||
dnl smmapdfw is free software; you can redistribute it and/or modify it
|
||||
dnl under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl smmapdfw is distributed in the hope that it will be useful, but WITHOUT
|
||||
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
dnl License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
dnl Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
VERSIONID(`$Id$')
|
||||
|
||||
|
||||
@ -75,6 +93,7 @@ Kverifier_helper _VERIFIER_WHITELIST_', `dnl
|
||||
Kverifier_helper _VERIFIER_BLACKLIST_')
|
||||
Kvht_logger syslog
|
||||
C{verifier_fix_white} postmaster
|
||||
Kvbestmx bestmx
|
||||
|
||||
LOCAL_RULESETS
|
||||
# This ruleset can be used to test the verifier in -bt mode
|
||||
@ -84,7 +103,9 @@ R$+ $: < $(verifier $1 $:none $) >
|
||||
Sverifier0
|
||||
R< $={verifier_fix_white} @ $+ > $@ < ok >
|
||||
R< $+ @ $+ > $: < $2 > < $(verifier_helper $1 @ $2 $: $) >
|
||||
R< $+ > < > $: < $(verifier_helper $1 $: $) >
|
||||
R< $+ > < > $: < $1 > < $(verifier_helper $1 $: $) >
|
||||
R< $+ > < > $: < $1 > < $(vbestmx $1 $) >
|
||||
R< $+ > < $+ . > $: < $(verifier_helper "mx:" $2 "" $: $) >
|
||||
ifelse(_mode_, `white', `dnl
|
||||
dnl if we found nothing in the whitelist, we continue with checking
|
||||
R< > $@ < cont >
|
||||
|
21
smmapdfw/mib/DE-HOTTIS-MIB.txt
Normal file
21
smmapdfw/mib/DE-HOTTIS-MIB.txt
Normal file
@ -0,0 +1,21 @@
|
||||
DE-HOTTIS-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-TYPE, Integer32, enterprises FROM SNMPv2-SMI
|
||||
;
|
||||
|
||||
deHottis MODULE-IDENTITY
|
||||
LAST-UPDATED "200411040000Z" -- 04 Nov 2004, midnight
|
||||
ORGANIZATION "hottis.de"
|
||||
CONTACT-INFO "postal: Wolfgang Hottgenroth
|
||||
Eupenstr. 20
|
||||
45259 Essen
|
||||
Germany
|
||||
|
||||
email: woho@hottis.de
|
||||
"
|
||||
DESCRIPTION "My main MIB
|
||||
"
|
||||
::= { enterprises 9676 }
|
||||
|
||||
END
|
354
smmapdfw/mib/DE-HOTTIS-SMMAPD-MIB.txt
Normal file
354
smmapdfw/mib/DE-HOTTIS-SMMAPD-MIB.txt
Normal file
@ -0,0 +1,354 @@
|
||||
DE-HOTTIS-SMMAPD-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-TYPE, Counter32 FROM SNMPv2-SMI
|
||||
deHottis FROM DE-HOTTIS-MIB
|
||||
;
|
||||
|
||||
deHottisSmmapdMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200411040000Z" -- 04 Nov 2004, midnight
|
||||
ORGANIZATION "hottis.de"
|
||||
CONTACT-INFO "postal: Wolfgang Hottgenroth
|
||||
Eupenstr. 20
|
||||
45259 Essen
|
||||
Germany
|
||||
|
||||
email: woho@hottis.de
|
||||
"
|
||||
DESCRIPTION "MIB for gathering statistics from smmapd
|
||||
"
|
||||
::= { deHottis 2 }
|
||||
|
||||
dhsSmmapdStats OBJECT IDENTIFIER ::= { deHottisSmmapdMIB 1 }
|
||||
|
||||
dhsNumber1 OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"number1"
|
||||
::= { dhsSmmapdStats 1 }
|
||||
|
||||
|
||||
DhsServerStat ::=
|
||||
SEQUENCE {
|
||||
dhsAccepted Counter32,
|
||||
dhsFailed Counter32,
|
||||
dhsRunningNwThreads Integer32,
|
||||
dhsNwThreads Counter32,
|
||||
dhsFailedNwThreads Counter32,
|
||||
dhsOKReturned Counter32,
|
||||
dhsTEMPReturned Counter32,
|
||||
dhsPERMReturned Counter32,
|
||||
dhsNOTFOUNDReturned Counter32,
|
||||
dhsIllegalInputFailure Counter32,
|
||||
dhsUnknownClassFailure Counter32,
|
||||
dhsTimeoutFailure Counter32,
|
||||
dhsNetStringFailure Counter32
|
||||
}
|
||||
|
||||
dhsServerStat OBJECT-TYPE
|
||||
SYNTAX DhsServerStat
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Statistics of the server"
|
||||
::= { dhsSmmapdStats 2 }
|
||||
|
||||
|
||||
dhsAccepted OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Connections accepted by the server"
|
||||
::= { dhsServerStat 1 }
|
||||
|
||||
dhsFailed OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Connections the server failed to accept"
|
||||
::= { dhsServerStat 2 }
|
||||
|
||||
dhsRunningNwThreads OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Running networker threads"
|
||||
::= { dhsServerStat 3 }
|
||||
|
||||
dhsNwThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Networker threads"
|
||||
::= { dhsServerStat 4 }
|
||||
|
||||
dhsFailedNwThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Networker threads failed to start"
|
||||
::= { dhsServerStat 5 }
|
||||
|
||||
dhsOKReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"OK returned to sendmail"
|
||||
::= { dhsServerStat 6 }
|
||||
|
||||
dhsTEMPReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"TEMP failure returned to sendmail"
|
||||
::= { dhsServerStat 7 }
|
||||
|
||||
dhsPERMReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"PERM failure returned to sendmail"
|
||||
::= { dhsServerStat 8 }
|
||||
|
||||
dhsNOTFOUNDReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"NOTFOUND returned to sendmail"
|
||||
::= { dhsServerStat 9 }
|
||||
|
||||
dhsIllegalInputFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Class not found (PERM) returned to sendmail"
|
||||
::= { dhsServerStat 10 }
|
||||
|
||||
dhsUnknownClassFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Class not found (PERM) returned to sendmail"
|
||||
::= { dhsServerStat 11 }
|
||||
|
||||
dhsTimeoutFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Timeout failure returned to sendmail"
|
||||
::= { dhsServerStat 12 }
|
||||
|
||||
dhsNetStringFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"NetString (NOK) returned to sendmail"
|
||||
::= { dhsServerStat 13 }
|
||||
|
||||
|
||||
DhsVerifierStat ::=
|
||||
SEQUENCE {
|
||||
dhsVCacheEntries Integer32,
|
||||
dhsVRunningWorkerThreads Integer32,
|
||||
dhsVWorkerThreads Counter32,
|
||||
dhsVFailedWorkerThreads Counter32,
|
||||
dhsVTimedOutWorkerThreads Counter32,
|
||||
dhsVRunningCheckerThreads Integer32,
|
||||
dhsVCheckerThreads Counter32,
|
||||
dhsVFailedCheckerThreads Counter32,
|
||||
dhsVAnsweredFromCache Counter32,
|
||||
dhsVReturnedOK Counter32,
|
||||
dhsVReturnedNOK Counter32,
|
||||
dhsVReturnedTNOK Counter32
|
||||
}
|
||||
|
||||
dhsVerifierStat OBJECT-TYPE
|
||||
SYNTAX DhsVerifierStat
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Statistics of the verifier"
|
||||
::= { dhsSmmapdStats 3 }
|
||||
|
||||
|
||||
dhsVCacheEntries OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Entries in verifier cache"
|
||||
::= { dhsVerifierStat 1 }
|
||||
|
||||
dhsVRunningWorkerThreads OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Running verifier worker threads"
|
||||
::= { dhsVerifierStat 2 }
|
||||
|
||||
dhsVWorkerThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"verifier worker threads"
|
||||
::= { dhsVerifierStat 3 }
|
||||
|
||||
dhsVFailedWorkerThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"failed to start verifier worker threads"
|
||||
::= { dhsVerifierStat 4 }
|
||||
|
||||
dhsVTimedOutWorkerThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"timed out verifier worker threads"
|
||||
::= { dhsVerifierStat 5 }
|
||||
|
||||
dhsVRunningCheckerThreads OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Running verifier checker threads"
|
||||
::= { dhsVerifierStat 6 }
|
||||
|
||||
dhsVCheckerThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"verifier checker threads"
|
||||
::= { dhsVerifierStat 7 }
|
||||
|
||||
dhsVFailedCheckerThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"failed to start verifier checker threads"
|
||||
::= { dhsVerifierStat 8 }
|
||||
|
||||
dhsVAnsweredFromCache OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"answers taken directly from cache"
|
||||
::= { dhsVerifierStat 9 }
|
||||
|
||||
dhsVReturnedOK OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"verifier returned OK"
|
||||
::= { dhsVerifierStat 10 }
|
||||
|
||||
dhsVReturnedNOK OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"verifier returned NOK"
|
||||
::= { dhsVerifierStat 11 }
|
||||
|
||||
dhsVReturnedTNOK OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"verifier returned TNOK"
|
||||
::= { dhsVerifierStat 12 }
|
||||
|
||||
|
||||
DhsCyrusStat ::=
|
||||
SEQUENCE {
|
||||
dhsCWorker Counter32,
|
||||
dhsCIllegalInput Counter32,
|
||||
dhsCDepotDNSFailure Counter32,
|
||||
dhsCReturnedOK Counter32,
|
||||
dhsCReturnedNOK Counter32,
|
||||
dhsCReturnedTNOK Counter32
|
||||
}
|
||||
|
||||
dhsCyrusStat OBJECT-TYPE
|
||||
SYNTAX DhsCyrusStat
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Statistics of the cyrus checker"
|
||||
::= { dhsSmmapdStats 4 }
|
||||
|
||||
|
||||
dhsCWorker OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"cyrus checkers"
|
||||
::= { dhsCyrusStat 1 }
|
||||
|
||||
dhsCIllegalInput OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"cyrus checkers with illegal input"
|
||||
::= { dhsCyrusStat 2 }
|
||||
|
||||
dhsCDepotDNSFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"cyrus checkers with depot DNS failure"
|
||||
::= { dhsCyrusStat 3 }
|
||||
|
||||
dhsCReturnedOK OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"cyrus checkers returned OK"
|
||||
::= { dhsCyrusStat 4 }
|
||||
|
||||
dhsCReturnedNOK OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"cyrus checkers returned NOK"
|
||||
::= { dhsCyrusStat 5 }
|
||||
|
||||
dhsCReturnedTNOK OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"cyrus checkers returned TNOK"
|
||||
::= { dhsCyrusStat 6 }
|
||||
|
||||
|
||||
END
|
2
smmapdfw/mib/Makefile.am
Normal file
2
smmapdfw/mib/Makefile.am
Normal file
@ -0,0 +1,2 @@
|
||||
data_DATA = DE-HOTTIS-MIB.txt DE-HOTTIS-SMMAPD-MIB.txt
|
||||
EXTRA_DIST = DE-HOTTIS-MIB.txt DE-HOTTIS-SMMAPD-MIB.txt
|
221
smmapdfw/mib/Makefile.in
Normal file
221
smmapdfw/mib/Makefile.in
Normal file
@ -0,0 +1,221 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
data_DATA = DE-HOTTIS-MIB.txt DE-HOTTIS-SMMAPD-MIB.txt
|
||||
EXTRA_DIST = DE-HOTTIS-MIB.txt DE-HOTTIS-SMMAPD-MIB.txt
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DATA = $(data_DATA)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu mib/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-dataDATA: $(data_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||
@list='$(data_DATA)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p; \
|
||||
else if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p; \
|
||||
fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-dataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(data_DATA)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(datadir)/$$p; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = mib
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu mib/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-dataDATA
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-dataDATA
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(DATA)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(datadir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: uninstall-dataDATA install-dataDATA tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
198
smmapdfw/missing
Executable file
198
smmapdfw/missing
Executable file
@ -0,0 +1,198 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
|
||||
# Franc,ois 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.in; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
||||
-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
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
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
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing - GNU libit 0.0"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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 missing on your system. 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 missing on your system. 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 missing on your system. 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
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. 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."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. 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 prerequirements 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
|
40
smmapdfw/mkinstalldirs
Executable file
40
smmapdfw/mkinstalldirs
Executable file
@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id$
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
10
smmapdfw/smmapd/Makefile.am
Normal file
10
smmapdfw/smmapd/Makefile.am
Normal file
@ -0,0 +1,10 @@
|
||||
noinst_HEADERS = containers.h snmp_subagent.h
|
||||
sysconf_DATA = smmapd.ini
|
||||
bin_PROGRAMS = smmapd
|
||||
smmapd_SOURCES = smmapd.c containers.c snmp_subagent.c
|
||||
smmapd_LDADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
CPPFLAGS = -DDEFAULT_SMMAPD_INI=\"$(sysconfdir)/smmapd.ini\" @CPPFLAGS@
|
||||
|
||||
EXTRA_DIST = smmapd.ini
|
392
smmapdfw/smmapd/Makefile.in
Normal file
392
smmapdfw/smmapd/Makefile.in
Normal file
@ -0,0 +1,392 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
noinst_HEADERS = containers.h snmp_subagent.h
|
||||
sysconf_DATA = smmapd.ini
|
||||
bin_PROGRAMS = smmapd
|
||||
smmapd_SOURCES = smmapd.c containers.c snmp_subagent.c
|
||||
smmapd_LDADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
CPPFLAGS = -DDEFAULT_SMMAPD_INI=\"$(sysconfdir)/smmapd.ini\" @CPPFLAGS@
|
||||
|
||||
EXTRA_DIST = smmapd.ini
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = smmapd$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
smmapd_OBJECTS = smmapd.$(OBJEXT) containers.$(OBJEXT) \
|
||||
snmp_subagent.$(OBJEXT)
|
||||
smmapd_DEPENDENCIES = ../libsmmapdfw/libsmmapdfw.la
|
||||
smmapd_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DATA = $(sysconf_DATA)
|
||||
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/containers.P .deps/smmapd.P .deps/snmp_subagent.P
|
||||
SOURCES = $(smmapd_SOURCES)
|
||||
OBJECTS = $(smmapd_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu smmapd/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
distclean-binPROGRAMS:
|
||||
|
||||
maintainer-clean-binPROGRAMS:
|
||||
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||
done
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
smmapd$(EXEEXT): $(smmapd_OBJECTS) $(smmapd_DEPENDENCIES)
|
||||
@rm -f smmapd$(EXEEXT)
|
||||
$(LINK) $(smmapd_LDFLAGS) $(smmapd_OBJECTS) $(smmapd_LDADD) $(LIBS)
|
||||
|
||||
install-sysconfDATA: $(sysconf_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
|
||||
@list='$(sysconf_DATA)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
|
||||
else if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
|
||||
fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-sysconfDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(sysconf_DATA)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(sysconfdir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP))
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = smmapd
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu smmapd/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-binPROGRAMS install-sysconfDATA
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-sysconfDATA
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS) $(DATA) $(HEADERS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-binPROGRAMS distclean-compile distclean-libtool \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||
clean-libtool maintainer-clean-libtool uninstall-sysconfDATA \
|
||||
install-sysconfDATA tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
|
||||
clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -1,11 +1,49 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include "containers.h"
|
||||
#include "config.h"
|
||||
#include "cfg.h"
|
||||
#include "smmapd.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
#define CFG_SECTION_GLOBAL "global"
|
||||
@ -22,7 +60,7 @@ classes_t *classes_head = &classes_root;
|
||||
|
||||
|
||||
int containers_setup(container_handle_t **ch) {
|
||||
*ch = (container_handle_t*)malloc(sizeof(container_handle_t));
|
||||
*ch = (container_handle_t*)htmalloc(sizeof(container_handle_t));
|
||||
(*ch)->worker_handle_root.next = NULL;
|
||||
return 0;
|
||||
}
|
||||
@ -93,7 +131,7 @@ int containers_dispatcher(container_handle_t *ch, char *input, char *output) {
|
||||
|
||||
if ((NULL == wh_last->next) && (NULL == wh2)) {
|
||||
syslog(LOG_DEBUG, "dispatcher: we haven't one, we create one");
|
||||
wh2 = (worker_handle_t*)malloc(sizeof(worker_handle_t));
|
||||
wh2 = (worker_handle_t*)htmalloc(sizeof(worker_handle_t));
|
||||
wh2->id = classes->id;
|
||||
if (NULL != classes->descr->work_setup_function) {
|
||||
err = (*classes->descr->work_setup_function)(classes->handle, &(wh2->handle));
|
||||
@ -133,7 +171,7 @@ static int register_class(int id, class_descriptor_t *class_descriptor) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
w = (classes_t *) malloc(sizeof(classes_t));
|
||||
w = (classes_t *) htmalloc(sizeof(classes_t));
|
||||
if (NULL == w) {
|
||||
syslog(LOG_ERR, "register_class: unable to alloc memory");
|
||||
return -2;
|
||||
@ -200,10 +238,6 @@ int register_all() {
|
||||
int id = 0;
|
||||
|
||||
cfg_plugin_dir = findcfg(cfg, CFG_SECTION_GLOBAL, CFG_NAME_PLUGIN_DIR);
|
||||
if (NULL == cfg_plugin_dir) {
|
||||
syslog(LOG_ERR, "register_all: no plugin dir configured");
|
||||
return -1;
|
||||
}
|
||||
|
||||
cfg_plugins = findcfg(cfg, CFG_SECTION_GLOBAL, CFG_NAME_PLUGINS);
|
||||
if (NULL == cfg_plugins) {
|
||||
@ -221,10 +255,12 @@ int register_all() {
|
||||
return -3;
|
||||
}
|
||||
|
||||
obj_name = (char*) malloc(strlen(cfg_plugin_dir) + strlen(cfg_obj) + 5);
|
||||
obj_name = (char*) htmalloc(((cfg_plugin_dir == NULL) ? 0 : strlen(cfg_plugin_dir)) + strlen(cfg_obj) + 5);
|
||||
obj_name[0] = '\0';
|
||||
strcat(obj_name, cfg_plugin_dir);
|
||||
strcat(obj_name, "/");
|
||||
if (cfg_plugin_dir != NULL) {
|
||||
strcat(obj_name, cfg_plugin_dir);
|
||||
strcat(obj_name, "/");
|
||||
}
|
||||
strcat(obj_name, cfg_obj);
|
||||
|
||||
dl_handle = dlopen(obj_name, RTLD_NOW);
|
61
smmapdfw/smmapd/containers.h
Normal file
61
smmapdfw/smmapd/containers.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _CONTAINERS_H_
|
||||
#define _CONTAINERS_H_
|
||||
|
||||
#define _SMMAPD_
|
||||
#include "containers_public.h"
|
||||
|
||||
struct classes_s {
|
||||
class_descriptor_t *descr;
|
||||
int id;
|
||||
void *handle;
|
||||
struct classes_s *next;
|
||||
};
|
||||
|
||||
typedef struct classes_s classes_t;
|
||||
|
||||
struct worker_handle_s {
|
||||
int id;
|
||||
void *handle;
|
||||
struct worker_handle_s *next;
|
||||
};
|
||||
|
||||
typedef struct worker_handle_s worker_handle_t;
|
||||
|
||||
struct container_handle_s {
|
||||
worker_handle_t worker_handle_root;
|
||||
};
|
||||
|
||||
typedef struct container_handle_s container_handle_t;
|
||||
|
||||
int containers_setup(container_handle_t **ch);
|
||||
int containers_destroy(container_handle_t *ch);
|
||||
int containers_dispatcher(container_handle_t *ch, char *input, char *output);
|
||||
|
||||
int register_all();
|
||||
|
||||
|
||||
#endif /* _CONTAINERS_H_ */
|
||||
|
||||
|
@ -1,34 +1,82 @@
|
||||
#include <stdio.h>
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "queue.h"
|
||||
#include "count.h"
|
||||
#include "containers.h"
|
||||
#include "config.h"
|
||||
#include "cfg.h"
|
||||
#include "safe_write.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
#define _SMMAPD_C_
|
||||
#include "smmapd.h"
|
||||
|
||||
#include "stats.h"
|
||||
#include "snmp_subagent.h"
|
||||
|
||||
#ifdef SUNOS
|
||||
#include "sunos_comp.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define CFG_SECTION_GLOBAL "global"
|
||||
#define CFG_NAME_ADDRESS "address"
|
||||
#define CFG_NAME_PORT "port"
|
||||
|
||||
#define CFG_NETSTRING_DISABLED "netstring_disabled"
|
||||
|
||||
#define DEFAULT_PORT "8888"
|
||||
|
||||
@ -49,10 +97,38 @@ typedef struct networkerThread_s networkerThread_t;
|
||||
|
||||
ht_queue_t terminated_networker_queue;
|
||||
pthread_t cleanerThread;
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
pthread_t statsThread;
|
||||
#endif
|
||||
|
||||
#if ENABLE_NETSNMP==1
|
||||
pthread_t snmpThread;
|
||||
#endif
|
||||
count_t thread_counter;
|
||||
|
||||
cfg_t *cfg;
|
||||
|
||||
int netstring_disabled = 0;
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
void * statser(void * arg) {
|
||||
int stdout_nice = atoi(findcfgx(cfg, "stats", "stdout_nice", "0"));
|
||||
int syslog_nice = atoi(findcfgx(cfg, "stats", "syslog_nice", "0"));
|
||||
int period = atoi(findcfgx(cfg, "stats", "period", "10"));
|
||||
|
||||
while(1) {
|
||||
outputStats(stdout_nice, syslog_nice);
|
||||
sleep(period);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_NETSNMP==1
|
||||
void * snmper(void * arg) {
|
||||
snmp_subagent_main(cfg);
|
||||
}
|
||||
#endif
|
||||
|
||||
void * cleaner(void * arg) {
|
||||
networkerThread_t *t;
|
||||
@ -65,6 +141,7 @@ void * cleaner(void * arg) {
|
||||
count_get(&thread_counter));
|
||||
t = (networkerThread_t*) queue_get_wait(&terminated_networker_queue);
|
||||
count_dec(&thread_counter);
|
||||
decStatCounter(STAT_CNT_NETWORKER_R_THREADS);
|
||||
|
||||
syslog(LOG_DEBUG, "cleaner: Networker serving %d (address: %s, port: %d), result %d",
|
||||
t->clientSock, inet_ntoa(t->clientAddr.sin_addr),
|
||||
@ -99,6 +176,8 @@ void * networker(void * arg) {
|
||||
networkerThread_t * thread = (networkerThread_t *) arg;
|
||||
thread->pthread = pthread_self();
|
||||
|
||||
incStatCounter(STAT_CNT_NETWORKER_THREADS);
|
||||
|
||||
syslog(LOG_DEBUG, "networker: serving %d (address: %s, port: %d) started",
|
||||
thread->clientSock, inet_ntoa(thread->clientAddr.sin_addr),
|
||||
ntohs(thread->clientAddr.sin_port));
|
||||
@ -114,27 +193,36 @@ void * networker(void * arg) {
|
||||
else
|
||||
buffer[cnt] = '\0';
|
||||
|
||||
len = strtol(buffer, &input, 10);
|
||||
if ((0 == len) && (buffer == input)) {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, no length found: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else if (*input++ != ':') {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, no colon found: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else if (strlen(input)-1 != len) {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, length does not match: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else if (input[strlen(input)-1] != ',') {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, no terminating comma: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
dispatcher_result = 0;
|
||||
if (netstring_disabled) {
|
||||
input = buffer;
|
||||
} else {
|
||||
input[strlen(input)-1] = '\0'; /* strip off the comma */
|
||||
|
||||
len = strtol(buffer, &input, 10);
|
||||
if ((0 == len) && (buffer == input)) {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, no length found: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else if (*input++ != ':') {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, no colon found: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else if (strlen(input)-1 != len) {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, length does not match: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else if (input[strlen(input)-1] != ',') {
|
||||
syslog(LOG_DEBUG, "networker: netstring unparsable, no terminating comma: %s", buffer);
|
||||
dispatcher_result = SMM_NETSTRING_UNPARSABLE;
|
||||
} else {
|
||||
input[strlen(input)-1] = '\0'; /* strip off the comma */
|
||||
}
|
||||
}
|
||||
|
||||
if (!dispatcher_result) {
|
||||
answer[0] = '\0';
|
||||
dispatcher_result = containers_dispatcher(container_handle, input, answer);
|
||||
syslog(LOG_DEBUG, "networker: dispatcher result: %d, answer: %s", dispatcher_result, answer);
|
||||
}
|
||||
|
||||
incStatCounter(dispatcher_result + STAT_CNT_OFFSET);
|
||||
|
||||
result_text = (dispatcher_result > SMM_MAX_NUM) ?
|
||||
T_SMM_RESULTS[0] :
|
||||
T_SMM_RESULTS[dispatcher_result];
|
||||
@ -146,11 +234,15 @@ void * networker(void * arg) {
|
||||
if (NULL == answer_ptr)
|
||||
answer_ptr = answer;
|
||||
|
||||
snprintf(output, OUTPUT_BUFSIZE, "%d:%s%s%s,",
|
||||
strlen(result_text) + strlen(answer_ptr) + ((strlen(answer_ptr) > 0) ? 1 : 0),
|
||||
result_text,
|
||||
(strlen(answer_ptr) > 0) ? " " : "",
|
||||
answer_ptr);
|
||||
if (netstring_disabled) {
|
||||
snprintf(output, OUTPUT_BUFSIZE, "%s\n", answer_ptr);
|
||||
} else {
|
||||
snprintf(output, OUTPUT_BUFSIZE, "%d:%s%s%s,",
|
||||
strlen(result_text) + strlen(answer_ptr) + ((strlen(answer_ptr) > 0) ? 1 : 0),
|
||||
result_text,
|
||||
(strlen(answer_ptr) > 0) ? " " : "",
|
||||
answer_ptr);
|
||||
}
|
||||
|
||||
safe_write(thread->clientSock, output, strlen(output));
|
||||
}
|
||||
@ -176,9 +268,14 @@ int server() {
|
||||
networkerThread_t *thread;
|
||||
pthread_t tid;
|
||||
int optval = 1;
|
||||
|
||||
int enableStats;
|
||||
int enableSnmp;
|
||||
|
||||
char *cfg_address, *cfg_port;
|
||||
|
||||
netstring_disabled = atoi(findcfgx(cfg, CFG_SECTION_GLOBAL, CFG_NETSTRING_DISABLED, "0"));
|
||||
|
||||
|
||||
serverSock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (-1 == serverSock) {
|
||||
syslog(LOG_ERR, "server: failure when creating server socket");
|
||||
@ -220,6 +317,21 @@ int server() {
|
||||
queue_init(&terminated_networker_queue);
|
||||
pthread_create(&cleanerThread, NULL, &cleaner, NULL);
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
enableStats = atoi(findcfgx(cfg, "global", "enable_stats", "0"));
|
||||
if (enableStats) {
|
||||
syslog(LOG_INFO, "server: starting stats thread");
|
||||
pthread_create(&statsThread, NULL, &statser, NULL);
|
||||
}
|
||||
#endif /* ENABLE_STATS */
|
||||
|
||||
#if ENABLE_NETSNMP==1
|
||||
enableSnmp = atoi(findcfgx(cfg, "global", "enable_snmp", "0"));
|
||||
if (enableSnmp) {
|
||||
syslog(LOG_INFO, "server: starting snmp subagent thread");
|
||||
pthread_create(&snmpThread, NULL, &snmper, NULL);
|
||||
}
|
||||
#endif /* ENABLE_NETSNMP */
|
||||
|
||||
while (1) {
|
||||
syslog(LOG_DEBUG, "server: Waiting for connection");
|
||||
@ -228,15 +340,18 @@ int server() {
|
||||
syslog(LOG_DEBUG, "server: Got a connection %d", clientSock);
|
||||
|
||||
if (-1 == clientSock) {
|
||||
syslog(LOG_ERR, "server: failure when accepting connection");
|
||||
return -1;
|
||||
incStatCounter(STAT_CNT_FAILED);
|
||||
syslog(LOG_ERR, "server: failure when accepting connection: %d, %s",
|
||||
errno, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
incStatCounter(STAT_CNT_ACCEPTED);
|
||||
|
||||
thread = (networkerThread_t *) malloc(sizeof(networkerThread_t)+10);
|
||||
thread = (networkerThread_t *) htmalloc(sizeof(networkerThread_t)+10);
|
||||
if (NULL == thread) {
|
||||
syslog(LOG_ERR, "server: unable to alloc memory for networker");
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -246,12 +361,15 @@ int server() {
|
||||
thread->clientAddrLen = clientAddrLen;
|
||||
|
||||
count_inc(&thread_counter);
|
||||
incStatCounter(STAT_CNT_NETWORKER_R_THREADS);
|
||||
res = pthread_create(&tid, NULL, &networker, thread);
|
||||
if (0 != res) {
|
||||
syslog(LOG_ERR, "server: unable to start networker thread");
|
||||
free(thread);
|
||||
decStatCounter(STAT_CNT_NETWORKER_R_THREADS);
|
||||
incStatCounter(STAT_CNT_NETWORKER_THREADS_FAILED);
|
||||
count_dec(&thread_counter);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,8 +386,6 @@ void usage() {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#define DEFAULT_SMMAPD_INI "smmapd.ini"
|
||||
|
||||
int err, pid, do_fork, foreground=0, c;
|
||||
char *pid_file=NULL, *cfg_file=NULL;
|
||||
|
||||
@ -281,10 +397,10 @@ int main(int argc, char **argv) {
|
||||
foreground = 1;
|
||||
break;
|
||||
case 'f':
|
||||
cfg_file = strdup(optarg);
|
||||
cfg_file = htstrdup(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
pid_file = strdup(optarg);
|
||||
pid_file = htstrdup(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
printf("\nsmmapd - Wolfgang Hottgenroth <woho@hottis.de>\n");
|
@ -3,37 +3,52 @@ do_fork = 0
|
||||
pid_file = smmapd.pid
|
||||
address = 127.0.0.1
|
||||
port = 8887
|
||||
plugin_dir = /home/who/Sources/sf/smmapdfw
|
||||
; plugin_dir = /home/who/Sources/sf/smmapdfw
|
||||
; plugins = test_worker1 test_worker2 verifier cyruscheck lua_worker
|
||||
plugins = lua_worker
|
||||
plugins = verifier
|
||||
enable_stats = 0
|
||||
enable_snmp = 1
|
||||
|
||||
; disables the netstring codec, only for debugging in the development
|
||||
; phase, sendmail is unable to talk to smmapd if the codec is disabled
|
||||
; netstring_disabled = 1
|
||||
|
||||
[snmp]
|
||||
agentx_socket = /var/agentx/master
|
||||
|
||||
[stats]
|
||||
stdout_nice = 2
|
||||
syslog_nice = 1
|
||||
period = 1
|
||||
|
||||
|
||||
[test_worker1]
|
||||
obj = test_workers.so
|
||||
obj = libtest_workers.so
|
||||
text = test worker1 handle text
|
||||
|
||||
[test_worker2]
|
||||
obj = test_workers.so
|
||||
obj = libtest_workers.so
|
||||
|
||||
[verifier]
|
||||
obj = verify_worker.so
|
||||
obj = libverify_worker.so
|
||||
timeout_result = 5
|
||||
timeout_dialog = 20
|
||||
cache_enabled = 1
|
||||
cache_expiry = 86400
|
||||
sender_address = <>
|
||||
ehlo_arg = local
|
||||
helo_arg = local
|
||||
smtp_port = 25
|
||||
max_checker_threads = 100
|
||||
|
||||
[cyruscheck]
|
||||
obj = cyrus_worker.so
|
||||
obj = libcyrus_worker.so
|
||||
timeout = 10
|
||||
sender_address = <testsender>
|
||||
lhlo_arg = local
|
||||
lmtp_port = 24
|
||||
|
||||
[lua_worker]
|
||||
obj = lua_worker.so
|
||||
obj = liblua_worker.so
|
||||
; load = base string table math loadlib io
|
||||
load = base string io
|
||||
lua_path = .
|
222
smmapdfw/smmapd/snmp_subagent.c
Normal file
222
smmapdfw/smmapd/snmp_subagent.c
Normal file
@ -0,0 +1,222 @@
|
||||
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if ENABLE_NETSNMP==1
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
#include <net-snmp/agent/net-snmp-agent-includes.h>
|
||||
|
||||
#include <syslog.h>
|
||||
|
||||
#include "stats.h"
|
||||
#include "smmapd.h"
|
||||
#include "cfg.h"
|
||||
|
||||
typedef struct var_cnt_map_s {
|
||||
char* var;
|
||||
int cnt;
|
||||
} var_cnt_map_t;
|
||||
|
||||
int number1 = 42;
|
||||
int counter32 = 1;
|
||||
int integer32 = 1;
|
||||
|
||||
var_cnt_map_t *var_cnt_map = NULL;
|
||||
int num_var_cnt_map = 0;
|
||||
|
||||
char *agentx_socket = NULL;
|
||||
|
||||
|
||||
int
|
||||
handle_number1(netsnmp_mib_handler *handler,
|
||||
netsnmp_handler_registration *reginfo,
|
||||
netsnmp_agent_request_info *reqinfo,
|
||||
netsnmp_request_info *requests)
|
||||
{
|
||||
switch(reqinfo->mode) {
|
||||
|
||||
case MODE_GET:
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
|
||||
(u_char *) &number1,
|
||||
sizeof(number1));
|
||||
break;
|
||||
|
||||
default:
|
||||
return SNMP_ERR_GENERR;
|
||||
}
|
||||
|
||||
return SNMP_ERR_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
handle_it(netsnmp_mib_handler *handler,
|
||||
netsnmp_handler_registration *reginfo,
|
||||
netsnmp_agent_request_info *reqinfo,
|
||||
netsnmp_request_info *requests,
|
||||
u_char type)
|
||||
{
|
||||
int i, cnt, value, res;
|
||||
for (i=0; i<num_var_cnt_map; i++)
|
||||
if (0 == strcmp(reginfo->handlerName, var_cnt_map[i].var)) {
|
||||
cnt = var_cnt_map[i].cnt;
|
||||
break;
|
||||
}
|
||||
|
||||
if (MODE_GET == reqinfo->mode) {
|
||||
value = getStatCounter(cnt);
|
||||
snmp_set_var_typed_value(requests->requestvb, type,
|
||||
(u_char *) &value,
|
||||
sizeof(value));
|
||||
res = SNMP_ERR_NOERROR;
|
||||
} else {
|
||||
res = SNMP_ERR_GENERR;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
handle_counter32(netsnmp_mib_handler *handler,
|
||||
netsnmp_handler_registration *reginfo,
|
||||
netsnmp_agent_request_info *reqinfo,
|
||||
netsnmp_request_info *requests)
|
||||
{
|
||||
return handle_it(handler, reginfo, reqinfo, requests, ASN_COUNTER);
|
||||
}
|
||||
|
||||
int
|
||||
handle_integer32(netsnmp_mib_handler *handler,
|
||||
netsnmp_handler_registration *reginfo,
|
||||
netsnmp_agent_request_info *reqinfo,
|
||||
netsnmp_request_info *requests)
|
||||
{
|
||||
return handle_it(handler, reginfo, reqinfo, requests, ASN_INTEGER);
|
||||
}
|
||||
|
||||
void map_var_cnt(int cnt, char* var) {
|
||||
var_cnt_map = (var_cnt_map_t*) realloc(var_cnt_map, sizeof(var_cnt_map_t) * (num_var_cnt_map + 1));
|
||||
var_cnt_map[num_var_cnt_map].var = var;
|
||||
var_cnt_map[num_var_cnt_map].cnt = cnt;
|
||||
num_var_cnt_map++;
|
||||
}
|
||||
|
||||
#define NETSNMP_REGISTER_SCALAR(A, B, C) netsnmp_register_scalar(netsnmp_create_handler_registration(#A, B, A##_oid, OID_LENGTH(A##_oid), HANDLER_CAN_RONLY)); map_var_cnt(C, #A)
|
||||
|
||||
void
|
||||
init_dhsMIBObjects(void)
|
||||
{
|
||||
static oid dhsNumber1_oid[] = { 1,3,6,1,4,1,9676,2,1,1 };
|
||||
static oid dhsAccepted_oid[] = { 1,3,6,1,4,1,9676,2,1,2,1 };
|
||||
static oid dhsFailed_oid[] = { 1,3,6,1,4,1,9676,2,1,2,2 };
|
||||
static oid dhsRunningNwThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,2,3 };
|
||||
static oid dhsNwThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,2,4 };
|
||||
static oid dhsFailedNwThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,2,5 };
|
||||
static oid dhsOKReturned_oid[] = { 1,3,6,1,4,1,9676,2,1,2,6 };
|
||||
static oid dhsTEMPReturned_oid[] = { 1,3,6,1,4,1,9676,2,1,2,7 };
|
||||
static oid dhsPERMReturned_oid[] = { 1,3,6,1,4,1,9676,2,1,2,8 };
|
||||
static oid dhsNOTFOUNDReturned_oid[] = { 1,3,6,1,4,1,9676,2,1,2,9 };
|
||||
static oid dhsIllegalInputFailure_oid[] = { 1,3,6,1,4,1,9676,2,1,2,10 };
|
||||
static oid dhsUnknownClassFailure_oid[] = { 1,3,6,1,4,1,9676,2,1,2,11 };
|
||||
static oid dhsTimeoutFailure_oid[] = { 1,3,6,1,4,1,9676,2,1,2,12 };
|
||||
static oid dhsNetStringFailure_oid[] = { 1,3,6,1,4,1,9676,2,1,2,13 };
|
||||
|
||||
static oid dhsVCacheEntries_oid[] = { 1,3,6,1,4,1,9676,2,1,3,1 };
|
||||
static oid dhsVRunningWorkerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,2 };
|
||||
static oid dhsVWorkerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,3 };
|
||||
static oid dhsVFailedWorkerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,4 };
|
||||
static oid dhsVTimedOutWorkerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,5 };
|
||||
static oid dhsVRunningCheckerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,6 };
|
||||
static oid dhsVCheckerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,7 };
|
||||
static oid dhsVFailedCheckerThreads_oid[] = { 1,3,6,1,4,1,9676,2,1,3,8 };
|
||||
static oid dhsVAnsweredFromCache_oid[] = { 1,3,6,1,4,1,9676,2,1,3,9 };
|
||||
static oid dhsVReturnedOK_oid[] = { 1,3,6,1,4,1,9676,2,1,3,10 };
|
||||
static oid dhsVReturnedNOK_oid[] = { 1,3,6,1,4,1,9676,2,1,3,11 };
|
||||
static oid dhsVReturnedTNOK_oid[] = { 1,3,6,1,4,1,9676,2,1,3,12 };
|
||||
|
||||
static oid dhsCWorker_oid[] = { 1,3,6,1,4,1,9676,2,1,4,1 };
|
||||
static oid dhsCIllegalInput_oid[] = { 1,3,6,1,4,1,9676,2,1,4,2 };
|
||||
static oid dhsCDepotDNSFailure_oid[] = { 1,3,6,1,4,1,9676,2,1,4,3 };
|
||||
static oid dhsCReturnedOK_oid[] = { 1,3,6,1,4,1,9676,2,1,4,4 };
|
||||
static oid dhsCReturnedNOK_oid[] = { 1,3,6,1,4,1,9676,2,1,4,5 };
|
||||
static oid dhsCReturnedTNOK_oid[] = { 1,3,6,1,4,1,9676,2,1,4,6 };
|
||||
|
||||
|
||||
DEBUGMSGTL(("dhsMIBObjects", "Initializing\n"));
|
||||
|
||||
NETSNMP_REGISTER_SCALAR(dhsNumber1, handle_number1, 0);
|
||||
NETSNMP_REGISTER_SCALAR(dhsAccepted, handle_counter32, STAT_CNT_ACCEPTED);
|
||||
NETSNMP_REGISTER_SCALAR(dhsFailed, handle_counter32, STAT_CNT_FAILED);
|
||||
NETSNMP_REGISTER_SCALAR(dhsRunningNwThreads, handle_integer32, STAT_CNT_NETWORKER_R_THREADS);
|
||||
NETSNMP_REGISTER_SCALAR(dhsNwThreads, handle_counter32, STAT_CNT_NETWORKER_THREADS);
|
||||
NETSNMP_REGISTER_SCALAR(dhsFailedNwThreads, handle_counter32, STAT_CNT_NETWORKER_THREADS_FAILED);
|
||||
NETSNMP_REGISTER_SCALAR(dhsOKReturned, handle_counter32, SMM_OK+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsTEMPReturned, handle_counter32, SMM_TEMP_NOK+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsPERMReturned, handle_counter32, SMM_PERM_NOK+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsNOTFOUNDReturned, handle_counter32, SMM_NOT_FOUND_NOK+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsIllegalInputFailure, handle_counter32, SMM_ILLEGAL_INPUT+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsUnknownClassFailure, handle_counter32, SMM_UNKNOWN_CLASS+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsTimeoutFailure, handle_counter32, SMM_TIMEOUT_NOK+STAT_CNT_OFFSET);
|
||||
NETSNMP_REGISTER_SCALAR(dhsNetStringFailure, handle_counter32, SMM_NETSTRING_UNPARSABLE+STAT_CNT_OFFSET);
|
||||
|
||||
NETSNMP_REGISTER_SCALAR(dhsVCacheEntries, handle_integer32, STAT_CNT_VERIFIER_CACHE);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVRunningWorkerThreads, handle_integer32, STAT_CNT_VERIFIER_WORKER_R_THREADS);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVWorkerThreads, handle_counter32, STAT_CNT_VERIFIER_WORKER_THREADS);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVFailedWorkerThreads, handle_counter32, STAT_CNT_VERIFIER_WORKER_THREADS_FAILED);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVTimedOutWorkerThreads, handle_counter32, STAT_CNT_VERIFIER_WORKER_THREADS_TIMEOUT);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVRunningCheckerThreads, handle_integer32, STAT_CNT_VERIFIER_CHECKER_R_THREADS);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVCheckerThreads, handle_counter32, STAT_CNT_VERIFIER_CHECKER_THREADS);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVFailedCheckerThreads, handle_counter32, STAT_CNT_VERIFIER_CHECKER_THREADS_FAILED);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVAnsweredFromCache, handle_counter32, STAT_CNT_VERIFIER_ANSWERED_FROM_CACHE);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVReturnedOK, handle_counter32, STAT_CNT_VERIFIER_RETURNED_OK);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVReturnedNOK, handle_counter32, STAT_CNT_VERIFIER_RETURNED_NOK);
|
||||
NETSNMP_REGISTER_SCALAR(dhsVReturnedTNOK, handle_counter32, STAT_CNT_VERIFIER_RETURNED_TNOK);
|
||||
|
||||
NETSNMP_REGISTER_SCALAR(dhsCWorker, handle_counter32, STAT_CNT_CYRUS_WORKER);
|
||||
NETSNMP_REGISTER_SCALAR(dhsCIllegalInput, handle_counter32, STAT_CNT_CYRUS_ILLEGAL_INPUT);
|
||||
NETSNMP_REGISTER_SCALAR(dhsCDepotDNSFailure, handle_counter32, STAT_CNT_CYRUS_DEPOT_DNS_FAILURE);
|
||||
NETSNMP_REGISTER_SCALAR(dhsCReturnedOK, handle_counter32, STAT_CNT_CYRUS_RETURNED_OK);
|
||||
NETSNMP_REGISTER_SCALAR(dhsCReturnedNOK, handle_counter32, STAT_CNT_CYRUS_RETURNED_NOK);
|
||||
NETSNMP_REGISTER_SCALAR(dhsCReturnedTNOK, handle_counter32, STAT_CNT_CYRUS_RETURNED_TNOK);
|
||||
|
||||
}
|
||||
|
||||
void snmp_subagent_main(cfg_t *cfg) {
|
||||
snmp_enable_syslog_ident("smmapd", LOG_LOCAL2);
|
||||
|
||||
agentx_socket = findcfgx(cfg, "snmp", "agentx_socket", "/var/agentx/master");
|
||||
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, agentx_socket);
|
||||
|
||||
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
|
||||
init_agent("smmapd_subagent");
|
||||
init_dhsMIBObjects();
|
||||
init_snmp("smmapd_subagent");
|
||||
|
||||
while(1) {
|
||||
agent_check_and_process(1);
|
||||
}
|
||||
|
||||
snmp_shutdown("mysubagent");
|
||||
}
|
||||
#endif
|
35
smmapdfw/smmapd/snmp_subagent.h
Normal file
35
smmapdfw/smmapd/snmp_subagent.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SNMP_SUBAGENT_H_
|
||||
#define _SNMP_SUBAGENT_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "cfg.h"
|
||||
|
||||
#if ENABLE_NETSNMP==1
|
||||
void snmp_subagent_main(cfg_t *cfg);
|
||||
#endif
|
||||
|
||||
#endif /* _SNMP_SUBAGENT_H_ */
|
||||
|
||||
|
75
smmapdfw/test/Connector.py
Normal file
75
smmapdfw/test/Connector.py
Normal file
@ -0,0 +1,75 @@
|
||||
import socket
|
||||
import time
|
||||
from threading import Thread, activeCount
|
||||
|
||||
|
||||
class NetStringError(ValueError): pass
|
||||
|
||||
def NetStringDecode(s):
|
||||
try:
|
||||
length, data = s.split(':', 1)
|
||||
except ValueError:
|
||||
raise NetStringError, "Separator not found"
|
||||
try:
|
||||
length = int(length)
|
||||
except ValueError:
|
||||
raise NetStringError, "Can not read length"
|
||||
if len(data) != length+1:
|
||||
raise NetStringError, "Data has unexpected length"
|
||||
if data[-1] != ',':
|
||||
raise NetStringError, "End-delimiter not found"
|
||||
return data[:-1]
|
||||
|
||||
def NetStringEncode(s):
|
||||
return str(len(s)) + ":" + s + ","
|
||||
|
||||
|
||||
class Connector (Thread):
|
||||
def __init__(self, config, details):
|
||||
Thread.__init__(self)
|
||||
self.config = config
|
||||
self.host = self.config.get('Global', 'Host')
|
||||
self.port = int(self.config.get('Global', 'Port'))
|
||||
self.klass = self.__class__.__name__
|
||||
self.details = details
|
||||
|
||||
def connect(self):
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.connect((self.host, self.port))
|
||||
|
||||
|
||||
def query(self, request):
|
||||
nets_request = NetStringEncode(self.klass + ' ' + request)
|
||||
|
||||
print(self.getName() + " REQUEST: " + nets_request)
|
||||
self.sock.sendall(nets_request)
|
||||
|
||||
nets_response = self.sock.recv(8192)
|
||||
print(self.getName() + " NETS_RESPONSE: " + nets_response)
|
||||
response = NetStringDecode(nets_response)
|
||||
print(self.getName() + " RESPONSE: " + response)
|
||||
|
||||
return response
|
||||
|
||||
def close(self):
|
||||
self.sock.close()
|
||||
|
||||
|
||||
def execute(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def run(self):
|
||||
return self.execute()
|
||||
|
||||
|
||||
def threadedExecute(config, klass, numOfThreads, details):
|
||||
threads = []
|
||||
|
||||
while (1):
|
||||
if activeCount() < numOfThreads:
|
||||
t = klass(config, details)
|
||||
t.start()
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
|
13
smmapdfw/test/test
Executable file
13
smmapdfw/test/test
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import ConfigParser
|
||||
|
||||
import Connector
|
||||
import verifier
|
||||
import test_worker1
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read("test.ini");
|
||||
|
||||
|
||||
Connector.threadedExecute(config, verifier.verifier, int(config.get('Global', 'Threads')), {})
|
10
smmapdfw/test/test.ini
Normal file
10
smmapdfw/test/test.ini
Normal file
@ -0,0 +1,10 @@
|
||||
[Global]
|
||||
Host: ddev8.eng.emea.uu.net
|
||||
Port: 389
|
||||
Threads: 20
|
||||
|
||||
[Verifier]
|
||||
AddressFile: addresses.lst
|
||||
QueriesPerSession: 2
|
||||
|
||||
|
6
smmapdfw/test/test_worker1.py
Normal file
6
smmapdfw/test/test_worker1.py
Normal file
@ -0,0 +1,6 @@
|
||||
from Connector import Connector
|
||||
|
||||
class test_worker1 (Connector):
|
||||
def __init__(self, config):
|
||||
Connector.__init__(self, config)
|
||||
|
29
smmapdfw/test/verifier.py
Normal file
29
smmapdfw/test/verifier.py
Normal file
@ -0,0 +1,29 @@
|
||||
import random
|
||||
from Connector import Connector
|
||||
|
||||
class verifier (Connector):
|
||||
addresses = None
|
||||
|
||||
def __init__(self, config, details):
|
||||
Connector.__init__(self, config, details)
|
||||
self.readAddressFile()
|
||||
random.seed()
|
||||
|
||||
def readAddressFile(self):
|
||||
if (verifier.addresses == None):
|
||||
addressFile = self.config.get('Verifier', 'AddressFile')
|
||||
f = open(addressFile)
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
verifier.addresses = map(lambda x: x[:-1].rstrip(), l)
|
||||
|
||||
|
||||
def execute(self):
|
||||
queriesPerSession = int(self.config.get('Verifier', 'QueriesPerSession'))
|
||||
self.connect()
|
||||
for i in range(queriesPerSession):
|
||||
a = verifier.addresses[int(random.random()*len(verifier.addresses))]
|
||||
self.query(a)
|
||||
self.close()
|
||||
|
||||
|
5
smmapdfw/test_worker/Makefile.am
Normal file
5
smmapdfw/test_worker/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
||||
lib_LTLIBRARIES = libtest_workers.la
|
||||
libtest_workers_la_SOURCES = test_workers.c
|
||||
libtest_workers_la_LIBADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
362
smmapdfw/test_worker/Makefile.in
Normal file
362
smmapdfw/test_worker/Makefile.in
Normal file
@ -0,0 +1,362 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
lib_LTLIBRARIES = libtest_workers.la
|
||||
libtest_workers_la_SOURCES = test_workers.c
|
||||
libtest_workers_la_LIBADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libtest_workers_la_LDFLAGS =
|
||||
libtest_workers_la_DEPENDENCIES = ../libsmmapdfw/libsmmapdfw.la
|
||||
libtest_workers_la_OBJECTS = test_workers.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/test_workers.P
|
||||
SOURCES = $(libtest_workers_la_SOURCES)
|
||||
OBJECTS = $(libtest_workers_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu test_worker/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libtest_workers.la: $(libtest_workers_la_OBJECTS) $(libtest_workers_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libtest_workers_la_LDFLAGS) $(libtest_workers_la_OBJECTS) $(libtest_workers_la_LIBADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP))
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = test_worker
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu test_worker/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-depend \
|
||||
distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -1,6 +1,28 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include "containers_public.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
int test_worker1_init(cfgl_t *cfg, void **handle);
|
||||
int test_worker1_setup(void *handle, void **work_handle);
|
||||
@ -43,7 +65,7 @@ int test_worker1_init(cfgl_t *cfg, void **handle) {
|
||||
}
|
||||
|
||||
int test_worker1_setup(void *handle, void **work_handle) {
|
||||
test_worker1_handle_t *twh = (test_worker1_handle_t*)malloc(sizeof(test_worker1_handle_t));
|
||||
test_worker1_handle_t *twh = (test_worker1_handle_t*)htmalloc(sizeof(test_worker1_handle_t));
|
||||
twh->counter = 0;
|
||||
*work_handle = twh;
|
||||
return 0;
|
6
smmapdfw/verify_worker/Makefile.am
Normal file
6
smmapdfw/verify_worker/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
||||
lib_LTLIBRARIES = libverify_worker.la
|
||||
libverify_worker_la_SOURCES = verify_worker.c
|
||||
libverify_worker_la_LIBADD = ../libsmmapdfw/libsmmapdfw.la @BDB_LIBS@
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
|
362
smmapdfw/verify_worker/Makefile.in
Normal file
362
smmapdfw/verify_worker/Makefile.in
Normal file
@ -0,0 +1,362 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 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.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BDB_LIBS = @BDB_LIBS@
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
HAVE_LIB = @HAVE_LIB@
|
||||
LIB = @LIB@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIB = @LTLIB@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
lib_LTLIBRARIES = libverify_worker.la
|
||||
libverify_worker_la_SOURCES = verify_worker.c
|
||||
libverify_worker_la_LIBADD = ../libsmmapdfw/libsmmapdfw.la @BDB_LIBS@
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libverify_worker_la_LDFLAGS =
|
||||
libverify_worker_la_DEPENDENCIES = ../libsmmapdfw/libsmmapdfw.la
|
||||
libverify_worker_la_OBJECTS = verify_worker.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/verify_worker.P
|
||||
SOURCES = $(libverify_worker_la_SOURCES)
|
||||
OBJECTS = $(libverify_worker_la_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu verify_worker/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libverify_worker.la: $(libverify_worker_la_OBJECTS) $(libverify_worker_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libverify_worker_la_LDFLAGS) $(libverify_worker_la_OBJECTS) $(libverify_worker_la_LIBADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags -o $$here/TAGS $(ETAGS_ARGS) $$tags $$unique $(LISP))
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = verify_worker
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu verify_worker/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-tags distclean-depend \
|
||||
distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-depend \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <pthread.h>
|
||||
@ -8,17 +34,21 @@
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if ENABLE_CACHE == 1
|
||||
#define DB_DBM_HSEARCH 1
|
||||
#include <db.h>
|
||||
#endif
|
||||
|
||||
#include "containers_public.h"
|
||||
#include "smmapd.h"
|
||||
|
||||
#include "dns.h"
|
||||
#include "htdns.h"
|
||||
#include "queue.h"
|
||||
#include "smtp.h"
|
||||
#include "htmalloc.h"
|
||||
|
||||
|
||||
#include "stats.h"
|
||||
|
||||
#define SMM_LOCAL_PERM_NOK 101
|
||||
#define SMM_LOCAL_TEMP_NOK 102
|
||||
@ -34,7 +64,7 @@ struct verify_container_handle_s {
|
||||
pthread_mutex_t *cache_mutex;
|
||||
char *cache_file;
|
||||
char *sender_address;
|
||||
char *ehlo_arg;
|
||||
char *helo_arg;
|
||||
int smtp_port;
|
||||
int max_checker_threads;
|
||||
};
|
||||
@ -131,13 +161,13 @@ class_descriptor_t verifier = {
|
||||
int verify_init(cfgl_t *cfg, void **handle) {
|
||||
verify_container_handle_t *vch;
|
||||
|
||||
vch = (verify_container_handle_t*) malloc(sizeof(verify_container_handle_t));
|
||||
vch = (verify_container_handle_t*) htmalloc(sizeof(verify_container_handle_t));
|
||||
vch->cfg = cfg;
|
||||
|
||||
vch->timeout_result = atoi(findcfglx(vch->cfg, "timeout_result", "5"));
|
||||
vch->timeout_dialog = atoi(findcfglx(vch->cfg, "timeout_dialog", "20"));
|
||||
vch->sender_address = findcfglx(vch->cfg, "sender_address", "<>");
|
||||
vch->ehlo_arg = findcfglx(vch->cfg, "ehlo_arg", "local");
|
||||
vch->helo_arg = findcfglx(vch->cfg, "helo_arg", "local");
|
||||
vch->smtp_port = atoi(findcfglx(vch->cfg, "smtp_port", "25"));
|
||||
vch->max_checker_threads = atoi(findcfglx(vch->cfg, "max_checker_threads", "25"));
|
||||
vch->cache_enabled = atoi(findcfglx(vch->cfg, "cache_enabled", "1"));
|
||||
@ -145,7 +175,7 @@ int verify_init(cfgl_t *cfg, void **handle) {
|
||||
vch->cache_file = findcfglx(vch->cfg, "cache_file", "verifier_cache");
|
||||
|
||||
if (1 == vch->cache_enabled) {
|
||||
vch->cache_mutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
|
||||
vch->cache_mutex = (pthread_mutex_t*) htmalloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(vch->cache_mutex, NULL);
|
||||
pthread_mutex_unlock(vch->cache_mutex);
|
||||
} else {
|
||||
@ -175,15 +205,15 @@ int verify_destroy(void *handle) {
|
||||
int verify_work_setup(void *handle, void **work_handle) {
|
||||
verify_work_handle_t *vwh;
|
||||
|
||||
vwh = (verify_work_handle_t*)malloc(sizeof(verify_work_handle_t));
|
||||
vwh = (verify_work_handle_t*)htmalloc(sizeof(verify_work_handle_t));
|
||||
vwh->id = 0;
|
||||
vwh->result = (verify_result_t*) malloc(sizeof(verify_result_t));
|
||||
vwh->result_mutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
|
||||
vwh->result = (verify_result_t*) htmalloc(sizeof(verify_result_t));
|
||||
vwh->result_mutex = (pthread_mutex_t*) htmalloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(vwh->result_mutex, NULL);
|
||||
pthread_mutex_unlock(vwh->result_mutex);
|
||||
vwh->result_cond = (pthread_cond_t*) malloc(sizeof(pthread_cond_t));
|
||||
vwh->result_cond = (pthread_cond_t*) htmalloc(sizeof(pthread_cond_t));
|
||||
pthread_cond_init(vwh->result_cond, NULL);
|
||||
vwh->terminator_queue = (ht_queue_t*) malloc(sizeof(ht_queue_t));
|
||||
vwh->terminator_queue = (ht_queue_t*) htmalloc(sizeof(ht_queue_t));
|
||||
queue_init(vwh->terminator_queue);
|
||||
vwh->vch = (verify_container_handle_t*)handle;
|
||||
|
||||
@ -197,12 +227,13 @@ int verify_work_destroy(void *handle, void *work_handle) {
|
||||
checker_thread_t *ct;
|
||||
int cnt, cnt2, err;
|
||||
|
||||
syslog(LOG_DEBUG, "verify_work_destroy: was %d times used", vwh->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work_destroy: was %d times used", work_handle, vwh->id);
|
||||
|
||||
/* The terminator_queue must be drained until id_counter is zero again */
|
||||
cnt = vwh->id;
|
||||
while (cnt != 0) {
|
||||
syslog(LOG_DEBUG, "verify_work_destroy, %d thread in queue, waiting for it", cnt);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work_destroy, %d thread in queue, waiting for it",
|
||||
work_handle, cnt);
|
||||
wt = (worker_thread_t*) queue_get_wait(vwh->terminator_queue);
|
||||
|
||||
cnt2 = wt->checker_cnt;
|
||||
@ -211,7 +242,9 @@ int verify_work_destroy(void *handle, void *work_handle) {
|
||||
/* clean up the checker stuff */
|
||||
|
||||
pthread_join(ct->thread, NULL);
|
||||
syslog(LOG_DEBUG, "verify_work_destroy, checker_thread (id=%d) joined", ct->id);
|
||||
decStatCounter(STAT_CNT_VERIFIER_CHECKER_R_THREADS);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work_destroy, checker_thread (id=%d) joined",
|
||||
work_handle, ct->id);
|
||||
|
||||
free(ct->output);
|
||||
free(ct);
|
||||
@ -220,7 +253,9 @@ int verify_work_destroy(void *handle, void *work_handle) {
|
||||
}
|
||||
|
||||
err = pthread_join(wt->thread, NULL);
|
||||
syslog(LOG_DEBUG, "verify_work_destroy, worker_thread (id=%d) joined", wt->id);
|
||||
decStatCounter(STAT_CNT_VERIFIER_WORKER_R_THREADS);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work_destroy, worker_thread (id=%d) joined",
|
||||
work_handle, wt->id);
|
||||
free(wt->input);
|
||||
|
||||
/* this will always be a pointer to something const or allocated, which
|
||||
@ -252,6 +287,7 @@ int verify_work_destroy(void *handle, void *work_handle) {
|
||||
|
||||
|
||||
void cache_insert(verify_container_handle_t *vch, const char *address, int result, const char *output) {
|
||||
#if ENABLE_CACHE == 1
|
||||
DBM *cache;
|
||||
datum data, key;
|
||||
int ret;
|
||||
@ -262,7 +298,7 @@ void cache_insert(verify_container_handle_t *vch, const char *address, int resul
|
||||
key.dsize = strlen(address) + 1; /* one more for the terminating \0 */
|
||||
key.dptr = (char*) address;
|
||||
data.dsize = (sizeof(mydata_t) + (sizeof(char) * (strlen(output) + 1)));
|
||||
mydata = (mydata_t *) malloc(data.dsize);
|
||||
mydata = (mydata_t *) htmalloc(data.dsize);
|
||||
mydata->result = result;
|
||||
mydata->timestamp = time(NULL);
|
||||
strcpy(mydata->output, output);
|
||||
@ -274,6 +310,7 @@ void cache_insert(verify_container_handle_t *vch, const char *address, int resul
|
||||
if (ret != 0) {
|
||||
syslog(LOG_DEBUG, "cache_insert: couldn't insert record");
|
||||
} else {
|
||||
incStatCounter(STAT_CNT_VERIFIER_CACHE);
|
||||
syslog(LOG_DEBUG, "cache_insert: record inserted");
|
||||
}
|
||||
dbm_close(cache);
|
||||
@ -282,9 +319,13 @@ void cache_insert(verify_container_handle_t *vch, const char *address, int resul
|
||||
|
||||
free(mydata);
|
||||
}
|
||||
#else
|
||||
syslog(LOG_DEBUG, "cache_insert: cache disabled");
|
||||
#endif /* ENABLE_CACHE */
|
||||
}
|
||||
|
||||
int cache_lookup(verify_container_handle_t *vch, const char* address, int *result, char **output) {
|
||||
#if ENABLE_CACHE == 1
|
||||
DBM *cache;
|
||||
datum data, key;
|
||||
mydata_t *mydata;
|
||||
@ -308,14 +349,16 @@ int cache_lookup(verify_container_handle_t *vch, const char* address, int *resul
|
||||
if ((mydata->timestamp + vch->cache_expiry) > time(NULL)) {
|
||||
syslog(LOG_DEBUG, "cache_lookup: not yet expired");
|
||||
*result = mydata->result;
|
||||
*output = (char*) malloc(sizeof(char) * (strlen(mydata->output) + 1));
|
||||
*output = (char*) htmalloc(sizeof(char) * (strlen(mydata->output) + 1));
|
||||
strcpy(*output, mydata->output);
|
||||
free(data.dptr);
|
||||
|
||||
/* Berkeley DB frees on its own! */
|
||||
/* free(data.dptr); */
|
||||
dbm_close(cache);
|
||||
res = 0;
|
||||
} else {
|
||||
syslog(LOG_DEBUG, "cache_lookup: expired, will be deleted from cache");
|
||||
free(data.dptr);
|
||||
/* free(data.dptr); --- Berkeley DB frees on its own */
|
||||
dbm_close(cache);
|
||||
|
||||
pthread_mutex_lock(vch->cache_mutex);
|
||||
@ -324,6 +367,7 @@ int cache_lookup(verify_container_handle_t *vch, const char* address, int *resul
|
||||
if (ret != 0) {
|
||||
syslog(LOG_DEBUG, "cache_insert: couldn't delete record");
|
||||
} else {
|
||||
decStatCounter(STAT_CNT_VERIFIER_CACHE);
|
||||
syslog(LOG_DEBUG, "cache_insert: record deleted");
|
||||
}
|
||||
dbm_close(cache);
|
||||
@ -335,6 +379,9 @@ int cache_lookup(verify_container_handle_t *vch, const char* address, int *resul
|
||||
}
|
||||
|
||||
return res;
|
||||
#else
|
||||
return -1;
|
||||
#endif /* ENABLE_CACHE */
|
||||
}
|
||||
|
||||
|
||||
@ -364,11 +411,11 @@ int cache_lookup(verify_container_handle_t *vch, const char* address, int *resul
|
||||
*/
|
||||
|
||||
#define PERM_NOK_RETURN(msg) \
|
||||
syslog(LOG_ERR, "verify_work: %s", msg); \
|
||||
syslog(LOG_ERR, "verify (%p) verify_work: %s", vwh, msg); \
|
||||
snprintf(output, ANSWER_BUFSIZE, "verify_work: %s", msg); \
|
||||
return SMM_PERM_NOK;
|
||||
#define TEMP_NOK_RETURN(msg) \
|
||||
syslog(LOG_ERR, "verify_work: %s", msg); \
|
||||
syslog(LOG_ERR, "verify (%p) verify_work: %s", vwh, msg); \
|
||||
snprintf(output, ANSWER_BUFSIZE, "verify_work: %s", msg); \
|
||||
return SMM_TEMP_NOK;
|
||||
|
||||
@ -381,41 +428,44 @@ int verify_work(void *handle, void *work_handle, char *input, char *output) {
|
||||
struct timespec ts;
|
||||
|
||||
|
||||
syslog(LOG_DEBUG, "verify_work: going to verify %s\n", input);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work: going to verify %s\n", vwh, input);
|
||||
|
||||
vwh->id += 1;
|
||||
|
||||
vwh->result->id = vwh->id;
|
||||
|
||||
wt = (worker_thread_t*) malloc(sizeof(worker_thread_t));
|
||||
wt = (worker_thread_t*) htmalloc(sizeof(worker_thread_t));
|
||||
wt->id = vwh->id;
|
||||
wt->terminator_queue = vwh->terminator_queue;
|
||||
wt->input = (char*) malloc(sizeof(char) * (strlen(input)+1));
|
||||
wt->input = (char*) htmalloc(sizeof(char) * (strlen(input)+1));
|
||||
strcpy(wt->input, input);
|
||||
wt->output = NULL;
|
||||
wt->mutex = vwh->result_mutex;
|
||||
wt->cond = vwh->result_cond;
|
||||
wt->result = vwh->result;
|
||||
wt->checker_terminator_queue = (ht_queue_t*) malloc(sizeof(ht_queue_t));
|
||||
wt->checker_terminator_queue = (ht_queue_t*) htmalloc(sizeof(ht_queue_t));
|
||||
queue_init(wt->checker_terminator_queue);
|
||||
wt->checker_cnt = 0;
|
||||
wt->vwh = work_handle;
|
||||
|
||||
syslog(LOG_DEBUG, "verify_work: going to start worker thread, id=%d", vwh->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work: going to start worker thread, id=%d",
|
||||
vwh, vwh->id);
|
||||
pthread_mutex_lock(vwh->result_mutex);
|
||||
err = pthread_create(&tid, NULL, &worker_thread, wt);
|
||||
if (-1 == err) {
|
||||
incStatCounter(STAT_CNT_VERIFIER_WORKER_THREADS_FAILED);
|
||||
free(wt->input);
|
||||
free(wt);
|
||||
PERM_NOK_RETURN("unable to create worker thread");
|
||||
}
|
||||
|
||||
syslog(LOG_DEBUG, "verify_work: waiting for result");
|
||||
pthread_mutex_lock(vwh->result_mutex);
|
||||
syslog(LOG_DEBUG, "verify (%p) verify_work: waiting for result", vwh);
|
||||
ts.tv_sec = time(0) + vch->timeout_result;
|
||||
ts.tv_nsec = 0;
|
||||
err = pthread_cond_timedwait(vwh->result_cond, vwh->result_mutex, &ts);
|
||||
pthread_mutex_unlock(vwh->result_mutex);
|
||||
if (ETIMEDOUT == err) {
|
||||
incStatCounter(STAT_CNT_VERIFIER_WORKER_THREADS_TIMEOUT);
|
||||
TEMP_NOK_RETURN("worker thread timed out");
|
||||
}
|
||||
|
||||
@ -443,7 +493,7 @@ static unsigned int *get_mx_ip_addresses(char *domain) {
|
||||
a_rdata = get_a_rrs((*mx_rdata2)->exchange);
|
||||
if (NULL != a_rdata) {
|
||||
for (a_rdata2 = a_rdata; *a_rdata2 != NULL; a_rdata2++) {
|
||||
addresses = (unsigned int*)realloc(addresses, sizeof(unsigned int)*(i+2)); /* 2 since first i==0 and
|
||||
addresses = (unsigned int*)htrealloc(addresses, sizeof(unsigned int)*(i+2)); /* 2 since first i==0 and
|
||||
we always need one more
|
||||
for the termination */
|
||||
*(addresses+i) = (*a_rdata2)->address;
|
||||
@ -471,7 +521,7 @@ static void *checker_thread(void *arg) {
|
||||
|
||||
int timeout = ct->vwh->vch->timeout_dialog;
|
||||
char *sender_address = ct->vwh->vch->sender_address;
|
||||
char *ehlo_arg = ct->vwh->vch->ehlo_arg;
|
||||
char *helo_arg = ct->vwh->vch->helo_arg;
|
||||
int port = ct->vwh->vch->smtp_port;
|
||||
|
||||
smtp_t *smtp;
|
||||
@ -485,10 +535,14 @@ static void *checker_thread(void *arg) {
|
||||
|
||||
|
||||
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d) started, %08x %s", ct->id, ct->ip_address, ct->email_address);
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d) started, %08x %s",
|
||||
ct->vwh, ct->id, ct->ip_address, ct->email_address);
|
||||
|
||||
ct->thread = pthread_self();
|
||||
|
||||
incStatCounter(STAT_CNT_VERIFIER_CHECKER_THREADS);
|
||||
incStatCounter(STAT_CNT_VERIFIER_CHECKER_R_THREADS);
|
||||
|
||||
/*
|
||||
Connect to ct->ip_address using ct->email_address,
|
||||
put the result text in ct->output, TBD: by copy or pointer,
|
||||
@ -498,19 +552,20 @@ static void *checker_thread(void *arg) {
|
||||
|
||||
|
||||
while ((END != state) && (0 == done)) {
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d), smtp dialog state %d", ct->id, state);
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d), smtp dialog state %d",
|
||||
ct->vwh, ct->id, state);
|
||||
switch(state) {
|
||||
case CONNECT:
|
||||
err = smtp_connect(smtp);
|
||||
break;
|
||||
case EHLO:
|
||||
err = smtp_ehlo(smtp, ehlo_arg);
|
||||
err = smtp_helo(smtp, helo_arg);
|
||||
break;
|
||||
case MAILFROM:
|
||||
err = smtp_mailfrom(smtp, sender_address);
|
||||
break;
|
||||
case RCPTTO:
|
||||
tmp_arg = (char*) malloc(sizeof(char) * (strlen(ct->email_address)+5));
|
||||
tmp_arg = (char*) htmalloc(sizeof(char) * (strlen(ct->email_address)+5));
|
||||
*tmp_arg = '\0';
|
||||
strcat(tmp_arg, "<");
|
||||
strcat(tmp_arg, ct->email_address);
|
||||
@ -530,7 +585,8 @@ static void *checker_thread(void *arg) {
|
||||
|
||||
switch(err) {
|
||||
case SMTP_TIMEOUT:
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d), timeout in smtp dialog", ct->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d), timeout in smtp dialog",
|
||||
ct->vwh, ct->id);
|
||||
ct->result = SMM_LOCAL_TEMP_NOK;
|
||||
response_text = (char*)TIMEOUT_ERROR;
|
||||
done = 1;
|
||||
@ -539,13 +595,15 @@ static void *checker_thread(void *arg) {
|
||||
/* evaluate smtp_response, return or continue */
|
||||
err = smtp_response(smtp, &response_text);
|
||||
if (-1 == err) {
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d), response could not be parsed", ct->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d), response could not be parsed",
|
||||
ct->vwh, ct->id);
|
||||
ct->result = SMM_LOCAL_TEMP_NOK;
|
||||
response_text = (char*)UNEXPECTED_ERROR;
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d), response: %d, %s (%d)", ct->id, err, response_text, strlen(response_text));
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d), response: %d, %s (%d)",
|
||||
ct->vwh, ct->id, err, response_text, strlen(response_text));
|
||||
switch(err/100) {
|
||||
case 4:
|
||||
ct->result = SMM_LOCAL_TEMP_NOK;
|
||||
@ -565,7 +623,8 @@ static void *checker_thread(void *arg) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d), unexpected error in smtp dialog", ct->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d), unexpected error in smtp dialog",
|
||||
ct->vwh, ct->id);
|
||||
ct->result = SMM_LOCAL_TEMP_NOK;
|
||||
response_text = (char*)UNEXPECTED_ERROR;
|
||||
done = 1;
|
||||
@ -575,12 +634,13 @@ static void *checker_thread(void *arg) {
|
||||
|
||||
smtp_close(smtp);
|
||||
|
||||
ct->output = (char*) malloc(sizeof(char) * (strlen(response_text)+1));
|
||||
ct->output = (char*) htmalloc(sizeof(char) * (strlen(response_text)+1));
|
||||
strcpy(ct->output, response_text);
|
||||
|
||||
smtp_destroy(smtp);
|
||||
|
||||
syslog(LOG_DEBUG, "checker_thread (id=%d) goes to terminator queue", ct->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) checker_thread (id=%d) goes to terminator queue",
|
||||
ct->vwh, ct->id);
|
||||
queue_put(ct->checker_terminator_queue, ct);
|
||||
}
|
||||
|
||||
@ -601,10 +661,13 @@ static void *worker_thread(void *arg) {
|
||||
static const char *NO_MX_AVAILABLE = "no MX available";
|
||||
static const char *NO_PERM_RESULT = "no checker returned permanent result";
|
||||
|
||||
syslog(LOG_DEBUG, "worker_thread %d started, %s", wt->id, wt->input);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread %d started, %s",
|
||||
wt->vwh, wt->id, wt->input);
|
||||
|
||||
wt->thread = pthread_self();
|
||||
|
||||
incStatCounter(STAT_CNT_VERIFIER_WORKER_R_THREADS);
|
||||
incStatCounter(STAT_CNT_VERIFIER_WORKER_THREADS);
|
||||
|
||||
|
||||
|
||||
@ -615,13 +678,15 @@ static void *worker_thread(void *arg) {
|
||||
result = SMM_LOCAL_PERM_NOK;
|
||||
} else {
|
||||
if (0 == cache_lookup(wt->vwh->vch, wt->input, &result, &cached_output)) {
|
||||
syslog(LOG_DEBUG, "worker_thread: got a cached result for %s -> %d, %s",
|
||||
wt->input, result, cached_output);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: got a cached result for %s -> %d, %s",
|
||||
wt->vwh, wt->input, result, cached_output);
|
||||
incStatCounter(STAT_CNT_VERIFIER_ANSWERED_FROM_CACHE);
|
||||
wt->output = cached_output;
|
||||
} else {
|
||||
domain_part += 1;
|
||||
|
||||
syslog(LOG_DEBUG, "worker_thread: looking up %s", domain_part);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: looking up %s",
|
||||
wt->vwh, domain_part);
|
||||
|
||||
mx_ip_addresses = get_mx_ip_addresses(domain_part);
|
||||
if (NULL == mx_ip_addresses) {
|
||||
@ -630,12 +695,13 @@ static void *worker_thread(void *arg) {
|
||||
} else {
|
||||
for (i = 0; (*(mx_ip_addresses+i) != 0) && (i < wt->vwh->vch->max_checker_threads); i++) {
|
||||
unsigned int address = *(mx_ip_addresses+i);
|
||||
syslog(LOG_DEBUG, "worker_thread: starting checker thread to %d.%d.%d.%d, for email-address %s",
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: starting checker thread to %d.%d.%d.%d, for email-address %s",
|
||||
wt->vwh,
|
||||
(address&0xff000000)>>24, (address&0x00ff0000)>>16,
|
||||
(address&0x0000ff00)>>8, (address&0x000000ff),
|
||||
wt->input);
|
||||
|
||||
ct = (checker_thread_t*) malloc(sizeof(checker_thread_t));
|
||||
ct = (checker_thread_t*) htmalloc(sizeof(checker_thread_t));
|
||||
ct->id = i+1; /* id of ct should start with 1, same as id of wt */
|
||||
ct->ip_address = address;
|
||||
ct->email_address = wt->input;
|
||||
@ -646,7 +712,8 @@ static void *worker_thread(void *arg) {
|
||||
|
||||
err = pthread_create(&tid, NULL, &checker_thread, ct);
|
||||
if (-1 == err) {
|
||||
syslog(LOG_ERR, "worker_thread: unable to create checker thread");
|
||||
incStatCounter(STAT_CNT_VERIFIER_CHECKER_THREADS_FAILED);
|
||||
syslog(LOG_ERR, "verify (%p) worker_thread: unable to create checker thread", wt->vwh);
|
||||
free(ct);
|
||||
} else {
|
||||
wt->checker_cnt += 1;
|
||||
@ -658,17 +725,19 @@ static void *worker_thread(void *arg) {
|
||||
while (wt->checker_cnt > 0) {
|
||||
ct = (checker_thread_t*) queue_get_wait(wt->checker_terminator_queue);
|
||||
wt->checker_cnt -= 1;
|
||||
syslog(LOG_DEBUG, "worker_thread: got checker result for %d.%d.%d.%d: %s -> %d, %s",
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: got checker result for %d.%d.%d.%d: %s -> %d, %s",
|
||||
wt->vwh,
|
||||
((ct->ip_address)&0xff000000)>>24, ((ct->ip_address)&0x00ff0000)>>16,
|
||||
((ct->ip_address)&0x0000ff00)>>8, ((ct->ip_address)&0x000000ff),
|
||||
wt->input, ct->result, ct->output);
|
||||
|
||||
pthread_join(ct->thread, NULL);
|
||||
syslog(LOG_DEBUG, "worker_thread: checker thread joined");
|
||||
decStatCounter(STAT_CNT_VERIFIER_CHECKER_R_THREADS);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: checker thread joined", wt->vwh);
|
||||
|
||||
if ((SMM_LOCAL_TEMP_NOK != ct->result) &&
|
||||
(SMM_TEMP_NOK != ct->result)) {
|
||||
syslog(LOG_DEBUG, "worker_thread: this is a permanent result, returning");
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: this is a permanent result, returning", wt->vwh);
|
||||
wt->output = ct->output;
|
||||
result = ct->result;
|
||||
cache_insert(wt->vwh->vch, wt->input, ct->result, ct->output);
|
||||
@ -676,7 +745,8 @@ static void *worker_thread(void *arg) {
|
||||
break; /* exit from the ct-collecting while loop, leave the rest of the ct's
|
||||
for the cleanup */
|
||||
} else {
|
||||
syslog(LOG_DEBUG, "worker_thread: this is a temporary result, continue to wait");
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: this is a temporary result, continue to wait",
|
||||
wt->vwh);
|
||||
wt->output = (char*) NO_PERM_RESULT;
|
||||
result = SMM_LOCAL_TEMP_NOK;
|
||||
/* we've collected the ct but its output is not longer need, so free it here */
|
||||
@ -691,24 +761,28 @@ static void *worker_thread(void *arg) {
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
syslog(LOG_DEBUG, "worker_thread %d waiting for mutex", wt->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread %d waiting for mutex",
|
||||
wt->vwh, wt->id);
|
||||
pthread_mutex_lock(wt->mutex);
|
||||
if (wt->result->id == wt->id) {
|
||||
syslog(LOG_DEBUG, "worker_thread %d returned result", wt->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread %d returned result", wt->vwh, wt->id);
|
||||
/* we can write the result */
|
||||
wt->result->output = (char*) malloc(sizeof(char) * (strlen(wt->output)+15)); /* enough for the output
|
||||
wt->result->output = (char*) htmalloc(sizeof(char) * (strlen(wt->output)+15)); /* enough for the output
|
||||
plus <><> and prefix */
|
||||
switch (result) {
|
||||
case SMM_LOCAL_TEMP_NOK:
|
||||
sprintf(wt->result->output, "<TNOK><%s>", wt->output);
|
||||
incStatCounter(STAT_CNT_VERIFIER_RETURNED_TNOK);
|
||||
result = SMM_OK;
|
||||
break;
|
||||
case SMM_LOCAL_PERM_NOK:
|
||||
sprintf(wt->result->output, "<NOK><%s>", wt->output);
|
||||
incStatCounter(STAT_CNT_VERIFIER_RETURNED_NOK);
|
||||
result = SMM_OK;
|
||||
break;
|
||||
case SMM_LOCAL_OK:
|
||||
sprintf(wt->result->output, "<OK><%s>", wt->output);
|
||||
incStatCounter(STAT_CNT_VERIFIER_RETURNED_OK);
|
||||
result = SMM_OK;
|
||||
break;
|
||||
default:
|
||||
@ -719,7 +793,7 @@ static void *worker_thread(void *arg) {
|
||||
wt->result->result = result;
|
||||
pthread_cond_signal(wt->cond);
|
||||
} else {
|
||||
syslog(LOG_DEBUG, "worker_thread %d drops result", wt->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread %d drops result", wt->vwh, wt->id);
|
||||
/* result not longer interested */
|
||||
}
|
||||
pthread_mutex_unlock(wt->mutex);
|
||||
@ -738,7 +812,8 @@ static void *worker_thread(void *arg) {
|
||||
free(cached_output);
|
||||
}
|
||||
|
||||
syslog(LOG_DEBUG, "worker_thread %d goes to terminator queue", wt->id);
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread %d goes to terminator queue",
|
||||
wt->vwh, wt->id);
|
||||
queue_put(wt->terminator_queue, wt);
|
||||
}
|
||||
|
Reference in New Issue
Block a user