Tag release 1.1.5.
This commit is contained in:
parent
90f25816e1
commit
274b3ef623
28
tags/gpgme-1.1.5/AUTHORS
Normal file
28
tags/gpgme-1.1.5/AUTHORS
Normal file
@ -0,0 +1,28 @@
|
||||
Package: gpgme
|
||||
Maintainer: Marcus Brinkmann <marcus@g10code.com>
|
||||
Bug reports: bug-gpgme@gnupg.org
|
||||
Security related bug reports: security@gnupg.org
|
||||
|
||||
|
||||
FSF <gnu@gnu.org>
|
||||
- Code taken from GnuPG 1.0: gpgme/w32-util.c, GnuPG 1.1: jnlib/.
|
||||
|
||||
g10 Code GmbH <code@g10code.com>
|
||||
- All stuff since mid march 2001.
|
||||
|
||||
Werner Koch <wk@gnupg.org>
|
||||
- Design and most stuff.
|
||||
|
||||
Wojciech Polak <polak@lodz.pdi.net>
|
||||
- gpgme.spec
|
||||
|
||||
|
||||
Copyright 2001, 2002 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
340
tags/gpgme-1.1.5/COPYING
Normal file
340
tags/gpgme-1.1.5/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.
|
510
tags/gpgme-1.1.5/COPYING.LESSER
Normal file
510
tags/gpgme-1.1.5/COPYING.LESSER
Normal file
@ -0,0 +1,510 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 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.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
^L
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
^L
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
^L
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
^L
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
^L
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
^L
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
^L
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
^L
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
769
tags/gpgme-1.1.5/ChangeLog
Normal file
769
tags/gpgme-1.1.5/ChangeLog
Normal file
@ -0,0 +1,769 @@
|
||||
2007-07-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 1.1.5.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
|
||||
|
||||
2007-07-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (GPGSM_DEFAULT) [*-mingw32*]: Initialize it.
|
||||
(HAVE_ASSUAN_H): Set to 1 if we have it.
|
||||
(funopen): Use AC_REPLACE_FUNCS.
|
||||
(USE_DESCRIPTOR_PASSING): Define to 1 if we have it. Do not
|
||||
define it at all if we don't.
|
||||
(NETLIBS) [have_w32_system]: Add -lws2_32.
|
||||
(DIRSEP_C, DIRSEP_S, EXPSEP_C, EXPSEP_S, PATHSEP_S)
|
||||
[HAVE_DOSISH_SYSTEM]: Remove definitions.
|
||||
|
||||
* assuan/assuan.h (_assuan_funopen): Define to _gpgme_funopen.
|
||||
* assuan/funopen.c: Move to ../gpgme/funopen.c.
|
||||
* assuan/Makefile.am (libassuan_la_SOURCES): Remove funopen.c.
|
||||
|
||||
2007-07-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan/Makefile.am (INCLUDES): Include $(top_srcdir)/gpgme.
|
||||
* assuan/assuan.h: Include <ath.h> instead of trying to duplicate
|
||||
the definitions.
|
||||
|
||||
* assuan/: Update files to 2007-07-04 version of assuan.
|
||||
|
||||
* autogen.sh: Use = not == in test.
|
||||
|
||||
2007-03-05 Werner Koch <wk@g10code.com>
|
||||
|
||||
Released 1.1.4.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
|
||||
|
||||
* autogen.sh: New option --force.
|
||||
|
||||
2007-01-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 1.1.3.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
|
||||
|
||||
2007-01-26 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac: Changed gpg and gpgsm version checks to work with
|
||||
arbitrary names of the gpg binary. New option --disable-gpg-test
|
||||
and --disable-gpgsm-test.
|
||||
|
||||
2007-01-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION): Must define
|
||||
after it may have been changed by an option.
|
||||
|
||||
2007-01-08 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac: Require gpg-error 1.4 due to the use of
|
||||
gpg_error_from_syserror.
|
||||
(HAVE_ASSUAN_H): New.
|
||||
|
||||
2007-01-05 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Add options --with-gpg-version and
|
||||
--with-gpgsm-version to allow overriding the minimum version
|
||||
requirements.
|
||||
|
||||
2006-12-17 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Fix two typos in last change.
|
||||
|
||||
2006-12-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Use descriptor passing only if --enable-fd-passing
|
||||
is provided.
|
||||
|
||||
* configure.ac: Add check for use of descriptor passing.
|
||||
|
||||
2006-11-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (NEED_GPG_VERSION): Bump to 1.3.0.
|
||||
|
||||
2006-09-19 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Turn stpcpy into a replacement function.
|
||||
Check for unistd.h and add setenv as replacement function.
|
||||
|
||||
2006-07-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Check for network libraries and set NETLIBS.
|
||||
|
||||
2006-07-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* lang, lang/cl: New subdirectories.
|
||||
* lang/Makefile.am, lang/README: New files.
|
||||
* configure.ac (AC_CONFIG_FILES): Add lang/Makefile,
|
||||
lang/cl/Makefile and lang/cl/gpgme.asd.
|
||||
* Makefile.am (SUBDIRS): Add lang.
|
||||
|
||||
2006-03-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump for release.
|
||||
|
||||
2006-02-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 1.1.1.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump for
|
||||
release.
|
||||
(LIBGPGME_LT_REVISION): Reset to 0 for release.
|
||||
|
||||
2006-01-05 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac: Test for inline feature.
|
||||
(AH_BOTTOM): New to define the pure attribute.
|
||||
|
||||
2006-01-03 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac: Append SVN revision to the version.
|
||||
|
||||
2005-11-18 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (BUILD_REVISION): New.
|
||||
|
||||
2005-11-17 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Add support for --enable-w32-glib (disabled by
|
||||
default). Invoke AM_PATH_GLIB_2_0.
|
||||
|
||||
2005-11-16 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (CFLAGS) [W32]: Make sure that -mms-bitfields are used.
|
||||
|
||||
2005-11-15 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac: Create BUILD_FILEVERSION from SVN Revision.
|
||||
|
||||
* autogen.sh [W32]: Build shared and static versions of the library.
|
||||
|
||||
2005-10-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* w32-dll/ChangeLog, w32-dll/build-dll, w32-dll/gpgme.def: Remove
|
||||
files.
|
||||
|
||||
* configure.ac: Instead checking for windres and dlltool, invoke
|
||||
AC_LIBTOOL_WIN32_DLL and AC_LIBTOOL_RC.
|
||||
* src/Makefile.am [HAVE_W32_SYSTEM]: Use libtool, which simplifies
|
||||
the rules.
|
||||
|
||||
2005-10-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 1.1.0.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump for
|
||||
release.
|
||||
(LIBGPGME_LT_REVISION): Reset to 0 for release.
|
||||
|
||||
2005-09-12 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (HAVE_PTH): Don't add $PTH_CFLAGS to $CFLAGS here.
|
||||
|
||||
2005-08-26 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (SEPCONSTANTS): New to define DIRSEP_C et al.
|
||||
|
||||
2005-08-19 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac [W32]: Create values for versioninfo.rc and list
|
||||
substuture versioninfo.rc.
|
||||
* configure.ac: Define ENABLE_GPGSM.
|
||||
|
||||
2005-08-08 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (stpcpy): Changed from replace to test.
|
||||
|
||||
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AH_BOTTOM): Removed.
|
||||
|
||||
2005-03-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Include autogen.sh
|
||||
|
||||
* autogen.sh: Added the usual code to build for W32 (--build-w32).
|
||||
|
||||
* configure.ac: Fixed the mingw32 host string, removed OS/2 stuff.
|
||||
(HAVE_DRIVE_LETTERS): Removed.
|
||||
(HAVE_W32_SYSTEM): Added.
|
||||
(AC_GNU_SOURCE): New to replace the identical AH_VERBATIM.
|
||||
(AH_BOTTOM): Added.
|
||||
|
||||
2004-12-28 Werner Koch <wk@g10code.com>
|
||||
|
||||
Released 1.0.2.
|
||||
|
||||
* Makefile.am (AUTOMAKE_OPTIONS): Build bzip 2 version.
|
||||
(ACLOCAL_AMFLAGS): Add -I m4.
|
||||
* configure.ac: Require automake 1.9.3 and autoconf 2.59.
|
||||
* acinclude.m4: Changed quoting for automake 1.9.
|
||||
* README: Use SHA1 instead of MD5.
|
||||
|
||||
2004-12-11 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Replace ttyname_r if it doesn't exist (and warn in
|
||||
that case).
|
||||
|
||||
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* README: Refer to COPYING.LESSER and "each file" instead of
|
||||
COPYING.
|
||||
* COPYING.LESSER: New file.
|
||||
* gpgme.spec.in (%doc): Add COPYING.LESSER.
|
||||
* acinclude.m4, configure.ac, Makefile.am: Change license to LGPL
|
||||
2.1 or later.
|
||||
* TODO: Add copyright notice.
|
||||
* README.CVS: Likewise.
|
||||
|
||||
* configure.ac (GPGSM_VERSION): Fix filter to get it.
|
||||
|
||||
2004-10-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 1.0.1.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump up to 2.
|
||||
(AC_INIT): Set version to 1.0.1.
|
||||
|
||||
* configure.ac: Set HAVE_GPGSM to true only if $GPGSM is not "no".
|
||||
|
||||
2004-09-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 1.0.0.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump up to 1.
|
||||
(AC_INIT): Set version to 1.0.0.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Remove README-alpha.
|
||||
* README-alpha: Remove file.
|
||||
|
||||
2004-09-17 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Disable AC_CONFIG_MACRO_DIR for now.
|
||||
|
||||
2004-09-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Improve diagnostics with version check.
|
||||
|
||||
* configure.ac: Print diagnostics about found thread libraries at
|
||||
the end. Check for the versions of GPG and GPGSM and print the
|
||||
found versions at the end.
|
||||
(HAVE_GPGSM): Do not require GPGSM to exist and be readable.
|
||||
(AC_CONFIG_MACRO_DIR): Invoke with argument m4.
|
||||
|
||||
* acinclude.m4: Add copyright notice.
|
||||
(jm_GLIBC21, AM_PATH_GPG_ERROR, _AC_PTH_ERROR, _AC_PTH_VERBOSE,
|
||||
AC_CHECK_PTH): Removed.
|
||||
|
||||
2004-06-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Check for <sys/uio.h>.
|
||||
|
||||
2004-06-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.9.0.
|
||||
|
||||
* configure.ac (AC_INIT): Set version number to 0.9.0.
|
||||
(LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump up by one.
|
||||
(LIBGPGME_LT_REVISION): Reset to zero.
|
||||
|
||||
2004-05-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (GPGME_CONFIG_API_VERSION): New variable,
|
||||
substitute it.
|
||||
|
||||
2004-04-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.4.7.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump it up.
|
||||
|
||||
2004-04-02 Thomas Schwinge <schwinge@nic-nac-project.de>
|
||||
|
||||
* autogen.sh: Added ACLOCAL_FLAGS.
|
||||
|
||||
2004-04-06 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.4.6.
|
||||
|
||||
* config.guess, config.sub, ltmain.sh: Updated to those from
|
||||
libtools 1.5.4.
|
||||
|
||||
2004-03-07 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.4.5.
|
||||
|
||||
* configure.ac (NEED_GPGSM_VERSION): Bump up to 1.9.6.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Remove autogen.sh and README.CVS.
|
||||
|
||||
2004-02-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac: Make the check for funopen fail with just a
|
||||
warning.
|
||||
|
||||
2004-02-11 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* autogen.sh (check_version): Removed bashism and simplified.
|
||||
|
||||
2004-02-10 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac: Fixed funopen test change.
|
||||
|
||||
2004-02-06 Moritz Schulte <mo@g10code.com>
|
||||
|
||||
* configure.ac: Fix funopen replacement mechanism.
|
||||
|
||||
2004-01-31 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Add invocation of AC_SYS_LARGEFILE, AC_TYPE_OFF_T
|
||||
and AC_FUNC_FSEEKO.
|
||||
|
||||
2004-01-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.4.4.
|
||||
|
||||
* configure.ac: Bumbed LT_Revision; now at C12/A1/R1.
|
||||
(NEED_GPGSM_VERSION): Set to 1.9.3.
|
||||
(min_automake_version): Added.
|
||||
* README.CVS: New.
|
||||
* Makefile.am (EXTRA_DIST): Added README.CVS.
|
||||
* autogen.sh: Updated.
|
||||
|
||||
2003-11-19 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* acinclude.m4: Add AM_PATH_GPG_ERROR.
|
||||
* configure.ac: Check for timegm. Made warning messages more
|
||||
prominent.
|
||||
|
||||
2003-10-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.4.3.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT, LIBGPGME_LT_AGE): Bump up by 1.
|
||||
(LIBGPGME_LT_REVISION): Set to 0.
|
||||
|
||||
2003-09-13 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Require libgpg-error 0.5.
|
||||
|
||||
* acinclude.m4: Remove libtool cruft, add jm_GLIBC21.
|
||||
* configure.ac: Add check for getenv_r, and call jm_GLIBC21.
|
||||
Define HAVE_THREAD_SAFE_GETENV if appropriate.
|
||||
|
||||
2003-09-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Remove GPGME_CONFIG_LIBS and GPGME_CONFIG_CFLAGS.
|
||||
|
||||
2003-09-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Move invocation of AC_CANONICAL_HOST up to
|
||||
suppress warning by autoconf.
|
||||
|
||||
2003-08-30 Robert Schiele <rschiele@uni-mannheim.de>
|
||||
|
||||
* gpgme.spec.in: %{_infodir}/dir is not packaged,
|
||||
remove to prevent checking failure.
|
||||
|
||||
2003-08-18 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: If building Assuan, check for funopen and
|
||||
fopencookie, and make isascii, putc_unlocked and memrchr
|
||||
replacement functions.
|
||||
(AM_PATH_GPG_ERROR): Require 0.3.
|
||||
|
||||
2003-07-31 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 0.4.3.
|
||||
|
||||
2003-07-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (LIBGPGME_LT_REVISION): Bump up to 1.
|
||||
|
||||
Released 0.4.2.
|
||||
|
||||
2003-07-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Complain if libgpg-error is not found.
|
||||
|
||||
2003-06-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 0.4.2.
|
||||
|
||||
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT): Bump up to 11.
|
||||
|
||||
* configure.ac: Use AM_PATH_GPG_ERROR.
|
||||
|
||||
* configure.ac: Check for libgpg-error. Define
|
||||
GPG_ERR_SOURCE_DEFAULT.
|
||||
|
||||
2003-05-26 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (NEED_GPG_VERSION): Bump up to 1.2.2.
|
||||
|
||||
2003-05-18 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
In all files, replace the Gpgme* type names with the new gpgme_*
|
||||
type names.
|
||||
|
||||
2003-02-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan/: Update files to 2002-11-10 version of assuan.
|
||||
|
||||
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* bonobo/gpgme.c, bonobo/main.c, bonobo/main.h, bonobo/Makefile,
|
||||
bonobo/Makefile.am, bonobo/Makefile.in: Dead files removed.
|
||||
* configure.ac: Remove automake conditional BUILD_BONOBO
|
||||
(AC_CONFIG_FILES): Remove bonobo/Makefile.
|
||||
* Makefile.am (bonobo): Remove variable.
|
||||
(SUBDIRS): Remove ${bonobo}.
|
||||
|
||||
* configure.ac: Remove all uses of GNUPG_CHECK_TYPEDEF, for byte,
|
||||
ushort, ulong, u16 and u32.
|
||||
* acinclude.m4 (GNUPG_CHECK_TYPEDEF): Remove macro.
|
||||
|
||||
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: New conditional HAVE_LD_VERSION_SCRIPT.
|
||||
Call AC_CANONICAL_HOST, use host instead target.
|
||||
|
||||
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Bump up to 0.4.1.
|
||||
|
||||
Released 0.4.0.
|
||||
|
||||
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* autogen.sh (automake_vers): Require 1.7 (really 1.7.1) for the
|
||||
conditional source distribution bug fix.
|
||||
|
||||
2002-12-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT): Increase by one.
|
||||
(LIBGPGME_LT_AGE, LIBGPGME_LT_REVISION): Set to 0.
|
||||
|
||||
2002-11-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* NEWS: Add note about moving "gpgmeplug" to the "cryptplug"
|
||||
package.
|
||||
* README: Remove instructions related to "gpgmeplug".
|
||||
* configure.ac: Remove enable option "gpgmeplug" and automake
|
||||
conditional BUILD_GPGMEPLUG, as well as the status info about it.
|
||||
(GPGMEPLUG): Remove variable.
|
||||
* Makefile.am (gpgmeplug): Remove variable.
|
||||
(SUBDIRS): Remove ${gpgmeplug}.
|
||||
* cryptplug.h, gpgme-openpgp.c, gpgmeplug.dox, gpgme-smime.c,
|
||||
Makefile.am, gpgmeplug.c, ChangeLog: Files removed.
|
||||
|
||||
2002-11-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Disable GPGSM for all dosish systems.
|
||||
|
||||
2002-10-12 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Add automake conditional HAVE_GPGSM.
|
||||
|
||||
2002-10-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version up to 0.4.0.
|
||||
(NEED_GPG_VERSION): Bump up to 1.2.0.
|
||||
(NEED_GPGSM_VERSION): Bump up to 0.9.0.
|
||||
* README: Update version numbers.
|
||||
* NEWS: Start entry for 0.4.0.
|
||||
|
||||
2002-09-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.3.11.
|
||||
|
||||
* configure.ac: Bump up LIBGPGME_LT_REVISION.
|
||||
|
||||
* configure.ac (AC_CHECK_HEADERS): Check for sys/select.h.
|
||||
|
||||
2002-09-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* autogen.sh (autoconf_vers): Bump up to 2.53 to get the @&t@
|
||||
quadrigraph. Always cutting the edge!
|
||||
|
||||
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Create and substitute LTLIBOBJS.
|
||||
|
||||
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.3.10.
|
||||
|
||||
* NEWS: Update for 0.3.9 release.
|
||||
* configure.ac: Bump up LIBGPGME_LT_REVISION.
|
||||
|
||||
2002-08-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.spec.in: Changed user name in Wojciech Polak's email
|
||||
address from ghostface to polak per request by himself.
|
||||
|
||||
2002-08-28 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* acinclude.m4 (GNUPG_CHECK_VA_COPY): New.
|
||||
* configure.ac: Use it.
|
||||
|
||||
2002-08-23 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac (GPGME_CONFIG_CFLAGS): Renamed from GPGME_CFLAGS
|
||||
and removed the libpath because it is set by the config script.
|
||||
|
||||
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Bump version number to 0.3.10.
|
||||
|
||||
* NEWS: Add template for development version.
|
||||
|
||||
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.3.9.
|
||||
|
||||
* NEWS: Update for 0.3.9 release.
|
||||
* Makefile.am (EXTRA_DIST): Add gpgme.spec.in.
|
||||
|
||||
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* jnlib/argparse.c, jnlib/argparse.h, jnlib/ChangeLog,
|
||||
jnlib/dotlock.c, jnlib/dotlock.h, jnlib/libjnlib-config.h,
|
||||
jnlib/logging.c, jnlib/logging.h,jnlib/Makefile.am,
|
||||
jnlib/mischelp.h, jnlib/README, jnlib/stringhelp.c,
|
||||
jnlib/stringhelp.h, jnlib/strlist.c, jnlib/strlist.h,
|
||||
jnlib/types.h, jnlib/xmalloc.c, jnlib/xmalloc.h: Remove files.
|
||||
|
||||
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (SUBDIRS): Remove jnlib.
|
||||
* configure.ac: Don't check for unsigned short or unsigned long.
|
||||
Don't check for memicmp, strlwr, strtoul, memmove, stricmp.
|
||||
Make stpcpy a replaced function.
|
||||
Don't define HAVE_JNLIB_LOGGING.
|
||||
Don't generate jnlib/Makefile.
|
||||
|
||||
2002-07-02 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac: Bumbed version number to 0.3.9; add a comment on
|
||||
when to change it.
|
||||
|
||||
* gpgme.spec.in: New. Contributed by Wojciech Polak.
|
||||
* Makefile.am (dist-hook): New.
|
||||
|
||||
* AUTHORS: Added Wojciech and bug reporting addresses.
|
||||
|
||||
2002-06-25 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.3.8.
|
||||
|
||||
* configure.ac: Bumbed LT version to 9/3/0.
|
||||
(NEED_GPGSM_VERSION): Need 0.3.8 due to fixed export command.
|
||||
|
||||
2002-06-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Released 0.3.7.
|
||||
|
||||
* configure.ac (AC_INIT): Set version to 0.3.7.
|
||||
(LIBGPGME_LT_REVISION): Add one.
|
||||
|
||||
* README: Document version requirement correctly.
|
||||
|
||||
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* acinclude.m4: Fix Pth check so that it doesn't error out if pth
|
||||
is not found.
|
||||
|
||||
2002-06-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Add checks for Pth and pthreads.
|
||||
* acinclude.m4: Add slightly hacked check for pth (seems to be an
|
||||
autoconf version problem).
|
||||
|
||||
2002-05-21 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac (NEED_GPGSM_VERSION): We need gpgsm 0.3.7.
|
||||
|
||||
2002-05-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.3.6.
|
||||
|
||||
2002-04-05 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* acconfig.h: File removed.
|
||||
* configure.ac (NEED_GPG_VERSION): Add description.
|
||||
(NEED_GPGSM_VERSION): Likewise.
|
||||
(HAVE_DOSISH_SYSTEM): Likewise.
|
||||
(HAVE_DRIVE_LETTERS): Likewise.
|
||||
(GPG_PATH): Likewise.
|
||||
(GPGSM_PATH): Likewise.
|
||||
* acinclude.m4 (GNUPG_CHECK_TYPEDEF): Likewise.
|
||||
|
||||
2002-04-01 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.3.5.
|
||||
|
||||
2002-03-17 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac: Add automake conditional HAVE_DOSISH_SYSTEM.
|
||||
|
||||
2002-03-04 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac: Bumbed version to 0.3.4-cvs to continue development.
|
||||
|
||||
Released 0.3.4.
|
||||
|
||||
* configure.ac: Bumbed LT version numbers to (7,1,0), requires
|
||||
gpgsm 0.3.1.
|
||||
|
||||
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AC_INIT): Change version number to snapshot CVS
|
||||
version.
|
||||
|
||||
2002-02-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac (vasprintf,fopencookie): Add checks.
|
||||
|
||||
2002-02-12 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 0.3.3.
|
||||
* jnlib/Makefile.am: Rever to older version that includes xmalloc
|
||||
but not dotlock and some other files. Reported by Stéphane
|
||||
Corthésy.
|
||||
|
||||
2002-02-10 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Released 0.3.2.
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 0.3.2.
|
||||
* jnlib/libjnlibconfig.h: Revert to older version that doesn't
|
||||
expect libgcrypt. Reported by Jose Carlos Garcia Sogo
|
||||
<jsogo@debian.org>.
|
||||
|
||||
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Released 0.3.1.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT): Bump it up to 6!
|
||||
(NEED_GPGSM_VERSION): Bump it up to 0.3.0!
|
||||
(AC_INIT): Bump version to 0.3.1
|
||||
|
||||
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (HAVE_JNLIB_LOGGING): Define always for assuan.
|
||||
|
||||
2001-12-19 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.ac (VERSION,PACKAGE): Defined and subst. Used for
|
||||
AM_INIT_AUTOMAKE and moved all version number more to the top.
|
||||
|
||||
2001-12-18 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* autogen.sh (libtool_vers): Bump to 1.4.
|
||||
|
||||
* configure.ac (LIBGPGME_LT_CURRENT): Increment.
|
||||
(LIBGPGME_LT_AGE): Reset.
|
||||
Improve comment.
|
||||
Fix wrong comment character.
|
||||
|
||||
2001-12-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* acinclude.m4 (GNUPG_FIX_HDR_VERSION): Fixed for new automake.
|
||||
|
||||
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (GPG): Substitute this variable.
|
||||
(GPGSM): Likewise.
|
||||
|
||||
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (AC_CONFIG_FILES): Add tests/gpg/Makefile and
|
||||
tests/gpgsm/Makefile.
|
||||
|
||||
2001-11-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (gpgmeplug): New variable, set to gpgmeplug if
|
||||
[BUILD_GPGMEPLUG].
|
||||
* configure.ac (AC_CONFIG_FILES): Add gpgmeplug/Makefile.
|
||||
Support --enable-gpgmeplug.
|
||||
|
||||
2001-11-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* autogen.sh: Tighten version dependencies.
|
||||
|
||||
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (SUBDIRS): Support building the assuan library
|
||||
(currently if GPGSM_PATH is set)..
|
||||
* configure.ac: Support building the assuan library.
|
||||
* assuan: New directory, populated with the Assuan library
|
||||
(copied from the newpg repository).
|
||||
|
||||
2001-11-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.ac (NEED_GPGSM_VERSION): New variable. Treat it
|
||||
similarly to NEED_GPG_VERSION.
|
||||
* acconfig.h: Likewise.
|
||||
|
||||
2001-11-18 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* configure.in: Renamed to ...
|
||||
* configure.ac: ... this. Update to autoconf 2.52. Lots of small
|
||||
changes in the transition. Support --with-gpg=PATH and
|
||||
--with-gpgsm=PATH options. Check if test suites can be run.
|
||||
* acconfig.h: Add GPGSM_PATH.
|
||||
* Makefile.am: New variable `tests', set to `tests' if
|
||||
RUN_GPG_TESTS.
|
||||
(SUBDIRS): Replace string `tests' with variable `tests'.
|
||||
|
||||
2001-10-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* autogen.sh: Invoke automake with `-a' (add missing files).
|
||||
Do not invoke configure.
|
||||
|
||||
2001-09-17 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.2.3.
|
||||
|
||||
* configure.in (NEED_GPG_VERSION): Set to 1.0.6. Incremented LT
|
||||
current and age.
|
||||
|
||||
* Makefile.am (SUBDIRS): Add doc
|
||||
|
||||
2001-06-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.2.2.
|
||||
|
||||
2001-04-05 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* configure.in (NEED_GPG_VERSION): Set to 1.0.4g
|
||||
|
||||
2001-04-02 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.2.1.
|
||||
|
||||
Changed the copyright notices all over the place.
|
||||
|
||||
2001-02-28 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Released 0.2.0.
|
||||
|
||||
2001-01-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* autogen.sh: Added option --build-w32.
|
||||
|
||||
|
||||
Copyright 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
229
tags/gpgme-1.1.5/INSTALL
Normal file
229
tags/gpgme-1.1.5/INSTALL
Normal file
@ -0,0 +1,229 @@
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
54
tags/gpgme-1.1.5/Makefile.am
Normal file
54
tags/gpgme-1.1.5/Makefile.am
Normal file
@ -0,0 +1,54 @@
|
||||
# Makefile.am - Top level Makefile for GPGME.
|
||||
# Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
# Copyright (C) 2001, 2002, 2004, 2005 g10 Code GmbH
|
||||
#
|
||||
# This file is part of GPGME.
|
||||
#
|
||||
# GPGME is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# GPGME is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AUTOMAKE_OPTIONS = dist-bzip2
|
||||
|
||||
EXTRA_DIST = gpgme.spec.in autogen.sh
|
||||
|
||||
if BUILD_ASSUAN
|
||||
assuan = assuan
|
||||
else
|
||||
assuan =
|
||||
endif
|
||||
|
||||
if BUILD_COMPLUS
|
||||
complus = complus
|
||||
else
|
||||
complus =
|
||||
endif
|
||||
|
||||
if RUN_GPG_TESTS
|
||||
tests = tests
|
||||
else
|
||||
tests =
|
||||
endif
|
||||
|
||||
SUBDIRS = ${assuan} gpgme ${tests} doc ${complus} lang
|
||||
|
||||
# Fix the version of the spec file and create a file named VERSION
|
||||
# to be used for patch's Prereq: feature.
|
||||
dist-hook:
|
||||
@set -e; \
|
||||
sed -e 's/@pkg_version@/$(VERSION)/g' \
|
||||
$(top_srcdir)/gpgme.spec.in > $(distdir)/gpgme.spec
|
||||
echo "$(VERSION)" > $(distdir)/VERSION
|
1193
tags/gpgme-1.1.5/NEWS
Normal file
1193
tags/gpgme-1.1.5/NEWS
Normal file
File diff suppressed because it is too large
Load Diff
123
tags/gpgme-1.1.5/README
Normal file
123
tags/gpgme-1.1.5/README
Normal file
@ -0,0 +1,123 @@
|
||||
GPGME - GnuPG Made Easy
|
||||
---------------------------
|
||||
|
||||
Copyright 2004, 2006 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
||||
|
||||
|
||||
Introduction
|
||||
--------------
|
||||
|
||||
GnuPG Made Easy (GPGME) is a C language library that allows to add
|
||||
support for cryptography to a program. It is designed to make access
|
||||
to public key crypto engines like GnuPG or GpgSM easier for
|
||||
applications. GPGME provides a high-level crypto API for encryption,
|
||||
decryption, signing, signature verification and key management.
|
||||
|
||||
GPGME uses GnuPG and GpgSM as its backends to support OpenPGP and the
|
||||
Cryptographic Message Syntax (CMS).
|
||||
|
||||
GPGME runs best on GNU/Linux or *BSD systems. Other Unices may
|
||||
require small portability fixes, send us your patches.
|
||||
|
||||
See the file COPYING.LESSER and each file for copyright and warranty
|
||||
information.
|
||||
|
||||
|
||||
Installation
|
||||
--------------
|
||||
|
||||
See the file INSTALL for generic installation instructions.
|
||||
|
||||
Check that you have unmodified sources. See below on how to do this.
|
||||
Don't skip it - this is an important step!
|
||||
|
||||
To build GPGME, you need to install libgpg-error. You need at least
|
||||
libgpg-error 0.5.
|
||||
|
||||
For support of the OpenPGP protocol (default), you should use the
|
||||
latest version of GnuPG 1.2 or 1.4, available at:
|
||||
ftp://ftp.gnupg.org/gcrypt/gnupg/
|
||||
|
||||
You need at least GnuPG 1.2.2.
|
||||
|
||||
If configure can't find the `gpg' binary in your path, you can specify
|
||||
the location with the --with-gpg=/path/to/gpg argument to configure.
|
||||
|
||||
For support of the CMS (Cryptographic Message Syntax) protocol, you
|
||||
need the latest CVS version of GnuPG 1.9, which is available in the
|
||||
GnuPG repository:
|
||||
http://www.gnupg.org/download/cvs_access.html
|
||||
Use the tag `GNUPG-1-9-BRANCH'. There are also snapshots available at:
|
||||
ftp://ftp.gnupg.org/gcrypt/alpha/gnupg/
|
||||
|
||||
You need at least GpgSM 1.9.6.
|
||||
|
||||
If configure can't find the `gpgsm' binary in your path, you can
|
||||
specify the location with the --with-gpgsm=/path/to/gpgsm argument to
|
||||
configure.
|
||||
|
||||
For building the CVS version of GPGME please see the file README.CVS
|
||||
for more information.
|
||||
|
||||
|
||||
How to Verify the Source
|
||||
--------------------------
|
||||
|
||||
In order to check that the version of GPGME which you are going to
|
||||
install is an original and unmodified one, you can do it in one of the
|
||||
following ways:
|
||||
|
||||
a) If you have a trusted Version of GnuPG installed, you can simply check
|
||||
the supplied signature:
|
||||
|
||||
$ gpg --verify gpgme-x.y.z.tar.gz.sig
|
||||
|
||||
This checks that the detached signature gpgme-x.y.z.tar.gz.sig is
|
||||
indeed a a signature of gpgme-x.y.z.tar.gz. The key used to create
|
||||
this signature is either of:
|
||||
|
||||
"pub 1024D/57548DCD 1998-07-07 Werner Koch (gnupg sig) <dd9jn@gnu.org>"
|
||||
"pub 1024D/87978569 1999-05-13
|
||||
Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
|
||||
Marcus Brinkmann <mb@g10code.com>"
|
||||
|
||||
If you do not have this key, you can get it from any keyserver. You
|
||||
have to make sure that this is really the key and not a faked one.
|
||||
You can do this by comparing the output of:
|
||||
|
||||
$ gpg --fingerprint 0x57548DCD
|
||||
|
||||
with the fingerprint published elsewhere.
|
||||
|
||||
b) If you don't have any of the above programs, you have to verify
|
||||
the SHA1 checksum:
|
||||
|
||||
$ sha1sum gpgme-x.y.z.tar.gz
|
||||
|
||||
This should yield an output _similar_ to this:
|
||||
|
||||
fd9351b26b3189c1d577f0970f9dcadc3412def1 gpgme-x.y.z.tar.gz
|
||||
|
||||
Now check that this checksum is _exactly_ the same as the one
|
||||
published via the announcement list and probably via Usenet.
|
||||
|
||||
|
||||
Documentation
|
||||
---------------
|
||||
|
||||
For information how to use the library you can read the info manual,
|
||||
which is also a reference book, in the doc/ directory. The programs
|
||||
in the tests/gpg/ directory may also prove useful.
|
||||
|
||||
Please subscribe to the gnupg-devel@gnupg.org mailing list if you want
|
||||
to do serious work.
|
||||
|
59
tags/gpgme-1.1.5/README.CVS
Normal file
59
tags/gpgme-1.1.5/README.CVS
Normal file
@ -0,0 +1,59 @@
|
||||
If you are building from CVS, run the script
|
||||
|
||||
./autogen.sh
|
||||
|
||||
first, to make sure that you have all the necessary maintainer tools
|
||||
are installed and to build the actual configuration files. Then run
|
||||
|
||||
./configure --enable-maintainer-mode
|
||||
|
||||
followed by the usual make.
|
||||
|
||||
If autogen.sh complains about insufficient versions of the required
|
||||
tools, or the tools are not installed, you may use environment
|
||||
variables to override the default tool names:
|
||||
|
||||
AUTOMAKE_SUFFIX is used as a suffix for all tools from the automake
|
||||
package. For example
|
||||
AUTOMAKE_SUFFIX="-1.7" ./autogen.sh
|
||||
uses "automake-1.7" and "aclocal-1.7.
|
||||
AUTOMAKE_PREFIX is used as a prefix for all tools from the automake
|
||||
page and may be combined with AUTOMAKE_SUFFIX. e.g.:
|
||||
AUTOMAKE_PREFIX=/usr/foo/bin ./autogen.sh
|
||||
uses "automake" and "aclocal" in the /usr/foo/bin
|
||||
directory.
|
||||
AUTOCONF_SUFFIX is used as a suffix for all tools from the automake
|
||||
package
|
||||
AUTOCONF_PREFIX is used as a prefix for all tools from the automake
|
||||
package
|
||||
GETTEXT_SUFFIX is used as a suffix for all tools from the gettext
|
||||
package
|
||||
GETTEXT_PREFIX is used as a prefix for all tools from the gettext
|
||||
package
|
||||
|
||||
It is also possible to use the variable name AUTOMAKE, AUTOCONF,
|
||||
ACLOCAL, AUTOHEADER, GETTEXT and MSGMERGE to directly specify the name
|
||||
of the programs to run. It is however better to use the suffix and
|
||||
prefix forms as described above because that does not require
|
||||
knowledge about the actual tools used by autgen.sh.
|
||||
|
||||
|
||||
Please don't use autopoint, libtoolize or autoreconf unless you are
|
||||
the current maintainer and want to update the standard configuration
|
||||
files. All those files should be in the CVS and only updated manually
|
||||
if the maintainer decides that newer versions are required. The
|
||||
maintainer should also make sure that the required version of automake
|
||||
et al. are properly indicated at the top of configure.ac and take care
|
||||
to copy the files and not merely use symlinks.
|
||||
|
||||
|
||||
Copyright 2004 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
32
tags/gpgme-1.1.5/THANKS
Normal file
32
tags/gpgme-1.1.5/THANKS
Normal file
@ -0,0 +1,32 @@
|
||||
For a list of the authors of the source code of GPGME, please see the
|
||||
file AUTHORS. The following people supported GPGME development in
|
||||
various ways (for example by finding bugs or giving advice), and we
|
||||
want to thank them for their help. If we forgot you, please let us
|
||||
know.
|
||||
|
||||
Adriaan de Groot adridg@cs.kun.nl
|
||||
Albrecht Dreß albrecht.dress@arcor.de
|
||||
Alfons Hoogervorst alfons@proteus.demon.nl
|
||||
Enno Cramer uebergeek@web.de
|
||||
Frank Heckenbach frank@g-n-u.de
|
||||
Igor Belyi gpgme@katehok.ac93.org
|
||||
Jan-Oliver Wagner jan@intevation.de
|
||||
Johannes Poehlmann jhp@caldera.de
|
||||
Jose C. García Sogo jose@jaimedelamo.eu.org
|
||||
Mark Mutz mutz@kde.org
|
||||
Miguel Coca mcoca@gnu.org
|
||||
Noel Torres envite@rolamasao.org
|
||||
Stéphane Corthésy stephane@sente.ch
|
||||
Timo Schulz twoaday@freakmail.de
|
||||
Tommy Reynolds reynolds@redhat.com
|
||||
|
||||
|
||||
Copyright 2001, 2002, 2004 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
175
tags/gpgme-1.1.5/TODO
Normal file
175
tags/gpgme-1.1.5/TODO
Normal file
@ -0,0 +1,175 @@
|
||||
Hey Emacs, this is -*- outline -*- mode!
|
||||
|
||||
* Before release:
|
||||
** Some gpg tests fail with gpg 1.3.4-cvs (gpg/t-keylist-sig)
|
||||
The test is currently disabled there and in gpg/t-import.
|
||||
** When gpg supports it, write binary subpackets directly,
|
||||
and parse SUBPACKET status lines.
|
||||
|
||||
* ABI's to break:
|
||||
** gpgme_edit_cb_t: Add "processed" return argument
|
||||
(see edit.c::command_handler).
|
||||
** I/O and User Data could be made extensible. But this can be done
|
||||
without breaking the ABI hopefully.
|
||||
* All enums that should be enums need to have a maximum value to ensure
|
||||
a certain minimum width for extensibility.
|
||||
** Compatibility interfaces that can be removed in future versions:
|
||||
*** gpgme_data_new_from_filepart
|
||||
*** gpgme_data_new_from_file
|
||||
*** gpgme_data_new_with_read_cb
|
||||
*** gpgme_data_rewind
|
||||
*** gpgme_op_import_ext
|
||||
*** gpgme_get_sig_key
|
||||
*** gpgme_get_sig_ulong_attr
|
||||
*** gpgme_get_sig_string_attr
|
||||
*** GPGME_SIG_STAT_*
|
||||
*** gpgme_get_sig_status
|
||||
*** gpgme_trust_item_release
|
||||
*** gpgme_trust_item_get_string_attr
|
||||
*** gpgme_trust_item_get_ulong_attr
|
||||
*** gpgme_attr_t
|
||||
*** All Gpgme* typedefs.
|
||||
|
||||
|
||||
* Thread support:
|
||||
** When GNU Pth supports sendmsg/recvmsg, wrap them properly.
|
||||
** Without timegm (3) support our ISO time parser is not thread safe.
|
||||
There is a configure time warning, though.
|
||||
|
||||
* New features:
|
||||
** Extended notation support. When gpg supports arbitrary binary
|
||||
notation data, provide a user interface for that.
|
||||
** notification system
|
||||
We need a simple notification system, probably a simple callback
|
||||
with a string and some optional arguments. This is for example
|
||||
required to notify an application of a changed smartcard, The
|
||||
application can then do whatever is required. There are other
|
||||
usages too. This notfication system should be independent of any
|
||||
contextes of course.
|
||||
** --learn-code support
|
||||
This might be integrated with import. we still need to work out how
|
||||
to learn a card when gpg and gpgsm have support for smartcards.
|
||||
** Might need a stat() for data objects and use it for length param to gpg.
|
||||
** Implement support for photo ids.
|
||||
** Allow selection of subkeys
|
||||
** Allow to return time stamps in ISO format
|
||||
This allows us to handle years later than 2037 properly. With the
|
||||
time_t interface they are all mapped to 2037-12-31
|
||||
** New features requested by our dear users, but rejected or left for
|
||||
later consideration:
|
||||
*** Allow to export secret keys.
|
||||
Rejected because this is conceptually flawed. Secret keys on a
|
||||
smart card can not be exported, for example.
|
||||
*** Selecting the key ring, setting the version or comment in output.
|
||||
Rejected because the naive implementation is engine specific, the
|
||||
configuration is part of the engine's configuration or readily
|
||||
worked around in a different way
|
||||
*** Selecting the symmetric cipher.
|
||||
*** Exchanging keys with key servers.
|
||||
|
||||
* Documentation
|
||||
** Document validity and trust issues.
|
||||
** In gpgme.texi: Register callbacks under the right letter in the index.
|
||||
|
||||
* Engines
|
||||
** Do not create/destroy engines, but create engine and then reset it.
|
||||
Internally the reset operation still spawns a new engine process,
|
||||
but this can be replaced with a reset later. Also, be very sure to
|
||||
release everything properly at a reset and at an error. Think hard
|
||||
about where to guarantee what (ie, what happens if start fails, are
|
||||
the fds unregistered immediately - i think so?)
|
||||
Note that we need support in gpgsm to set include-certs to default
|
||||
as RESET does not reset it.
|
||||
** Optimize the case where a data object has 0an underlying fd we can pass
|
||||
directly to the engine. This will be automatic with socket I/O and
|
||||
descriptor passing.
|
||||
** Move code common to all engines up from gpg to engine.
|
||||
** engine operations can return General Error on unknown protocol
|
||||
(it's an internal error, as select_protocol checks already).
|
||||
** When server mode is implemented properly, more care has to be taken to
|
||||
release all resources on error (for example to free assuan_cmd).
|
||||
* GPG breakage:
|
||||
** gpg 1.4.2 lacks error reporting if sign/encrypt with revoked key.
|
||||
** gpg 1.4.2 does crappy error reporting (namely none at all) when
|
||||
smart card is missing for sign operation:
|
||||
[GNUPG:] CARDCTRL 4
|
||||
gpg: selecting openpgp failed: ec=6.110
|
||||
gpg: signing failed: general error
|
||||
[GNUPG:] BEGIN_ENCRYPTION 2 10
|
||||
gpg: test: sign+encrypt failed: general error
|
||||
** Without agent and with wrong passphrase, gpg 1.4.2 enters into an
|
||||
infinite loop.
|
||||
** Use correct argv[0]
|
||||
In rungpg.c:build_argv we use
|
||||
argv[argc] = strdup ("gpg"); /* argv[0] */
|
||||
This should be changed to take the real file name used in account.
|
||||
|
||||
|
||||
* Operations
|
||||
** Include cert values -2, -1, 0 and 1 should be defined as macros.
|
||||
** If an operation failed, make sure that the result functions don't return
|
||||
corrupt partial information. !!!
|
||||
NOTE: The EOF status handler is not called in this case !!!
|
||||
** Verify must not fail on NODATA premature if auto-key-retrieval failed.
|
||||
It should not fail silently if it knows there is an error. !!!
|
||||
** All operations: Better error reporting. !!
|
||||
** Export status handler need much more work. !!!
|
||||
** Import should return a useful error when one happened.
|
||||
*** Import does not take notice of NODATA status report.
|
||||
*** When GPGSM does issue IMPORT_OK status reports, make sure to check for
|
||||
them in tests/gpgs m/t-import.c.
|
||||
** Verify can include info about version/algo/class, but currently
|
||||
this is only available for gpg, not gpgsm.
|
||||
** Return ENC_TO output in verify result. Again, this is not available
|
||||
for gpgsm.
|
||||
** Genkey should return something more useful than General_Error.
|
||||
** If possible, use --file-setsize to set the file size for proper progress
|
||||
callback handling. Write data interface for file size.
|
||||
** Optimize the file descriptor list, so the number of open fds is
|
||||
always known easily.
|
||||
** Encryption: It should be verified that the behaviour for partially untrusted
|
||||
recipients is correct.
|
||||
** When GPG issues INV_something for invalid signers, catch them.
|
||||
|
||||
* Error Values
|
||||
** Map ASSUAN/GpgSM ERR error values in a better way than is done now. !!
|
||||
** Some error values should identify the source more correctly (mostly error
|
||||
values derived from status messages).
|
||||
|
||||
* Tests
|
||||
** Write a fake gpg-agent so that we can supply known passphrases to
|
||||
gpgsm and setup the configuration files to use the agent. Without
|
||||
this we are testing a currently running gpg-agent which is not a
|
||||
clever idea. !
|
||||
** t-data
|
||||
*** Test gpgme_data_release_and_get_mem.
|
||||
*** Test gpgme_data_seek for invalid types.
|
||||
** t-keylist
|
||||
Write a test for ext_keylist.
|
||||
** Test reading key signatures.
|
||||
|
||||
* Debug
|
||||
** Handle malloc and vasprintf errors. But decide first if they should be
|
||||
ignored (and logged with 255?!), or really be assertions. !
|
||||
|
||||
* Build suite
|
||||
** Make sure everything is cleaned correctly (esp. test area).
|
||||
** Enable AC_CONFIG_MACRO_DIR and bump up autoconf version requirement.
|
||||
(To fix "./autogen.sh; ./configure --enable-maintainer-mode; touch
|
||||
configure.ac; make"). Currently worked around with ACLOCAL_AMFLAGS???
|
||||
|
||||
* Error checking
|
||||
** engine-gpgsm, with-validation
|
||||
Add error checking some time after releasing a new gpgsm.
|
||||
|
||||
|
||||
Copyright 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
86
tags/gpgme-1.1.5/acinclude.m4
Normal file
86
tags/gpgme-1.1.5/acinclude.m4
Normal file
@ -0,0 +1,86 @@
|
||||
dnl Macros to configure GPGME
|
||||
dnl Copyright (C) 2004 g10 Code GmbH
|
||||
dnl
|
||||
dnl This file is part of GPGME.
|
||||
dnl
|
||||
dnl GPGME is free software; you can redistribute it and/or modify it
|
||||
dnl under the terms of the GNU Lesser General Public License as
|
||||
dnl published by the Free Software Foundation; either version 2.1 of the
|
||||
dnl License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl GPGME 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 Lesser General
|
||||
dnl Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Lesser General Public
|
||||
dnl License along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
dnl GNUPG_FIX_HDR_VERSION(FILE, NAME)
|
||||
dnl Make the version number stored in NAME in the header file FILE the
|
||||
dnl same as the one here. This is easier than to have a .in file just
|
||||
dnl for one substitution.
|
||||
dnl We must use a temp file in the current directory because make
|
||||
dnl distcheck installs all sourcefiles RO.
|
||||
dnl (wk 2001-12-18)
|
||||
AC_DEFUN([GNUPG_FIX_HDR_VERSION],
|
||||
[ sed "s/^#define $2 \".*/#define $2 \"$VERSION\"/" $srcdir/$1 > fixhdr.tmp
|
||||
if cmp -s $srcdir/$1 fixhdr.tmp 2>/dev/null; then
|
||||
rm -f fixhdr.tmp
|
||||
else
|
||||
rm -f $srcdir/$1
|
||||
if mv fixhdr.tmp $srcdir/$1 ; then
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([[
|
||||
***
|
||||
*** Failed to fix the version string macro $2 in $1.
|
||||
*** The old file has been saved as fixhdr.tmp
|
||||
***]])
|
||||
fi
|
||||
AC_MSG_WARN([fixed the $2 macro in $1])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl GNUPG_CHECK_VA_COPY()
|
||||
dnl Do some check on how to implement va_copy.
|
||||
dnl May define MUST_COPY_VA_BY_VAL.
|
||||
dnl Actual test code taken from glib-1.1.
|
||||
AC_DEFUN([GNUPG_CHECK_VA_COPY],
|
||||
[ AC_MSG_CHECKING(whether va_lists must be copied by value)
|
||||
AC_CACHE_VAL(gnupg_cv_must_copy_va_byval,[
|
||||
if test "$cross_compiling" = yes; then
|
||||
gnupg_cv_must_copy_va_byval=no
|
||||
else
|
||||
gnupg_cv_must_copy_va_byval=no
|
||||
AC_TRY_RUN([
|
||||
#include <stdarg.h>
|
||||
void f (int i, ...)
|
||||
{
|
||||
va_list args1, args2;
|
||||
va_start (args1, i);
|
||||
args2 = args1;
|
||||
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
|
||||
exit (1);
|
||||
va_end (args1);
|
||||
va_end (args2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
f (0, 42);
|
||||
return 0;
|
||||
}
|
||||
],gnupg_cv_must_copy_va_byval=yes)
|
||||
fi
|
||||
])
|
||||
if test "$gnupg_cv_must_copy_va_byval" = yes; then
|
||||
AC_DEFINE(MUST_COPY_VA_BYVAL,1,[used to implement the va_copy macro])
|
||||
fi
|
||||
if test "$cross_compiling" = yes; then
|
||||
AC_MSG_RESULT(assuming $gnupg_cv_must_copy_va_byval)
|
||||
else
|
||||
AC_MSG_RESULT($gnupg_cv_must_copy_va_byval)
|
||||
fi
|
||||
])
|
991
tags/gpgme-1.1.5/assuan/ChangeLog
Normal file
991
tags/gpgme-1.1.5/assuan/ChangeLog
Normal file
@ -0,0 +1,991 @@
|
||||
2007-07-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-defs.h (struct assuan_context_s): Have partial peercred
|
||||
structure even if HAVE_W32_SYSTEM, and have full peercred
|
||||
structure only if HAVE_SO_PEERCRED.
|
||||
* assuan-connect.c (assuan_get_peercred) [!HAVE_SO_PEERCRED]: Do
|
||||
not try to set PID, UID and GID.
|
||||
|
||||
2007-07-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
Change _WIN32 to HAVE_W32_SYSTEM for consistency.
|
||||
|
||||
* assuan-defs.h (struct assuan_context_s): Have full peercred
|
||||
structure even if not HAVE_SO_PEERCRED, but not if
|
||||
HAVE_W32_SYSTEM.
|
||||
|
||||
2007-06-18 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-logging.c (load_libgpg_error, _assuan_gpg_strerror_r)
|
||||
(_assuan_gpg_strsource): New.
|
||||
* assuan-handler.c (process_request) [W32]: Use these new
|
||||
functions for human understable error codes.
|
||||
|
||||
2007-06-12 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-io.c (_assuan_simple_read): Hack to allow reading from a
|
||||
socket.
|
||||
(_assuan_simple_write): Likewise.
|
||||
|
||||
2007-06-11 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-io-pth.c (_assuan_simple_read, _assuan_simple_write): Use
|
||||
pth versions also for W32.
|
||||
|
||||
2007-05-29 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-io-pth.c: Include sys/socket.h only if available. Remove
|
||||
double inclusion of sys/wait.h
|
||||
|
||||
* assuan-pipe-connect.c (build_w32_commandline): Make ARGV const.
|
||||
|
||||
* assuan-pipe-server.c (is_valid_socket) [W32]: Do not define.
|
||||
|
||||
* assuan-socket-server.c [W32]: Include ws2tcpip.h to define
|
||||
socklen_t.
|
||||
* assuan-defs.h (struct assuan_context_s): Define most peercred
|
||||
members only if we can really set them.
|
||||
(_assuan_simple_sendmsg, _assuan_simple_recvmsg) [W32]: Use a
|
||||
different prototype.
|
||||
* assuan.h (assuan_get_peercred) [W32]: Do not define.
|
||||
* assuan-io.c (_assuan_simple_sendmsg, _assuan_simple_recvmsg)
|
||||
[w32]: Use another prototype.
|
||||
|
||||
2007-05-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* libassuan.m4: Print found version on success.
|
||||
|
||||
2007-05-01 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-uds.c (uds_reader): Cast void ptr for arithmetics.
|
||||
Reported by Peter O'Gorman.
|
||||
|
||||
2006-12-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-handler.c (assuan_command_parse_fd): Also allow white
|
||||
space after FD.
|
||||
|
||||
2006-12-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-uds.c (uds_reader): Return 0 if recvmsg returns 0.
|
||||
|
||||
2006-12-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-client.c (assuan_transact): Also translate some of the
|
||||
legacy error codes.
|
||||
|
||||
2006-11-22 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-handler.c (fun1_cookie_write, fun2_cookie_write): New.
|
||||
(assuan_get_data_fp) [HAVE_FUNOPEN]: Use it.
|
||||
|
||||
2006-11-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* Makefile.am (libassuan_pth_a_CFLAGS): New.
|
||||
|
||||
* assuan-pipe-server.c (_assuan_release_context): Free CMDTBL.
|
||||
|
||||
2006-11-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* libassuan.m4 (AM_CHECK_LIBASSUAN): New.
|
||||
|
||||
* assuan-handler.c (assuan_register_post_cmd_notify)
|
||||
(assuan_register_post_cmd_notify): New.
|
||||
* assuan-util.c (assuan_set_io_monitor): New.
|
||||
* assuan-buffer.c (_assuan_read_line): Use it.
|
||||
(_assuan_write_line): Ditto.
|
||||
(_assuan_cookie_write_data): Ditto.
|
||||
(_assuan_cookie_write_flush): Ditto.
|
||||
|
||||
2006-10-18 Werner Koch <wk@g10code.com>
|
||||
|
||||
* libassuan.m4: Pass "pthread" to the common macro. Reported by
|
||||
Rex Dieter.
|
||||
|
||||
2006-10-16 Werner Koch <wk@g10code.com>
|
||||
|
||||
* mkerrors: Map ASSUAN_Not_Confirmed.
|
||||
|
||||
2006-10-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* libassuan.m4 (AM_PATH_LIBASSUAN_PTH)
|
||||
(AM_PATH_LIBASSUAN_PTHREAD): Fixed.
|
||||
|
||||
* assuan-buffer.c (assuan_sendfd): Implement a runtime detection
|
||||
of implemented descripotr passing.
|
||||
|
||||
* assuan-uds.c: Take care of USE_DESCRIPTOR_PASSING.
|
||||
|
||||
* assuan-defs.h: Add missing semicolon.
|
||||
|
||||
2006-10-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-handler.c (process_request): Use weak pragma for the sake
|
||||
of old gcc's. Reported by Alain Guibert.
|
||||
|
||||
* assuan-io.c: Removed Pth support.
|
||||
* assuan-io-pth.c: New. Based on assuan-io.c
|
||||
|
||||
2006-10-06 Werner Koch <wk@g10code.com>
|
||||
|
||||
* libassuan-config.in: New options --api-version and --thread.
|
||||
|
||||
2006-10-04 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-client.c (assuan_transact): Need to map old assuan status
|
||||
codes so that for example CANCELED is correctly mapped.
|
||||
|
||||
2006-09-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-client.c (assuan_transact): Do not convert error on
|
||||
status line, it is already a gpg-error. Do convert
|
||||
ASSUAN_Server_Fault.
|
||||
|
||||
2006-09-19 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan.h (assuan_init_socket_server_ext)
|
||||
[_ASSUAN_EXT_SYM_PREFIX]: Fix typo in macro.
|
||||
|
||||
2006-09-19 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-defs.h (putc_unlocked): Add prototype.
|
||||
|
||||
* assuan-socket-server.c (accept_connection): Made LEN a socklen_t.
|
||||
|
||||
* assuan.h: Replaced assuan error code enum by simple defines and
|
||||
made assuan_error_t an int.
|
||||
* mkerrors: Changed parser accordingly.
|
||||
|
||||
2006-09-19 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-pipe-connect.c: Add hacks for Slowaris.
|
||||
* assuan-socket.c: Likewise here.
|
||||
|
||||
* assuan.h (enum): Avoid trailing comma in enumerator list. Ugh.
|
||||
|
||||
* mkerrors (_assuan_error): Change return type to assuan_error_t.
|
||||
* assuan-buffer.c (_assuan_read_line): Change return type to
|
||||
assuan_error_t. Map returned value of -1.
|
||||
(_assuan_write_line): Change type of RC to assuan_error_t.
|
||||
* assuan-defs.h (_assuan_read_line, _assuan_error): Likewise for
|
||||
prototypes.
|
||||
|
||||
* assuan-defs.h (unsetenv): Define correctly.
|
||||
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-io.c (_assuan_waitpid): New. Changed all waitpid calls
|
||||
to this.
|
||||
|
||||
* assuan.h (_ASSUAN_DEPRECATED): New internal macro.
|
||||
(assuan_pipe_connect2): Declare deprecated.
|
||||
(assuan_init_connected_socket_server): Declare deprecated.
|
||||
|
||||
* assuan-connect.c (assuan_get_peercred): New.
|
||||
* assuan-socket-server.c (accept_connection_bottom): Save uid and gid.
|
||||
|
||||
2006-09-13 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-client.c (assuan_transact): Need to map the error code.
|
||||
* mkerrors: Need to map ASSUAN_No_Secret_Key.
|
||||
|
||||
* assuan-pipe-server.c (is_valid_socket): New.
|
||||
(assuan_init_pipe_server): Use UDS with the environmet variable is
|
||||
set and a valid descriptor is given. Ignore FILEDES in this case.
|
||||
|
||||
* assuan-socket-server.c (assuan_init_socket_server_ext): New.
|
||||
Changed other init fucntions to make use of it.
|
||||
|
||||
* assuan-handler.c (assuan_command_parse_fd): Allow for lowercase
|
||||
"fd".
|
||||
(std_handler_reset): Close pending fds.
|
||||
* assuan-uds.c (uds_receivefd): Fixed.
|
||||
(_assuan_uds_close_fds): New.
|
||||
|
||||
* assuan-socket-connect.c (assuan_socket_connect_ext): New. Takes
|
||||
all code of assuan_socket_connect plus an option to use sendmsg.
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect_ext): New arg FLAGS.
|
||||
|
||||
2006-09-12 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-buffer.c (_assuan_write_line): Also log the prefix.
|
||||
|
||||
* assuan-defs.h (DIM, DIMof): New.
|
||||
|
||||
* assuan-domain-server.c: Removed.
|
||||
* assuan-domain-connect.c: Renamed to ..
|
||||
* assuan-uds.c: this.
|
||||
(domain_reader, domain_writer, domain_sendfd, domain_receivefd)
|
||||
(assuan_domain_connect, _assuan_domain_init): Removed.
|
||||
(uds_reader, uds_writer, uds_sendfd, uds_receivefd)
|
||||
(_assuan_init_uds_io): New.
|
||||
(_assuan_uds_deinit): New.
|
||||
|
||||
* assuan-io.c (_assuan_simple_sendmsg, _assuan_simple_recvmsg): New.
|
||||
(my_pth_fdmode, my_pth_select): New.
|
||||
|
||||
2006-09-11 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-pipe-server.c (assuan_init_pipe_server): Allow for
|
||||
FILEDES to be NULL and try to start as a socketpair server in this
|
||||
case.
|
||||
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect2): Split up into two
|
||||
functions (unix and w32) for clarity.
|
||||
(pipe_connect_unix): This is the new fucntion. Add USE_CMSG flag.
|
||||
(pipe_connect_w32): Ditto.
|
||||
(initial_handshake): Factored out code.
|
||||
(socketpair_connect): New.
|
||||
(assuan_pipe_connect_ext): New.
|
||||
(do_finish): Handle case if outbound and inbound fd are the same.
|
||||
This is to support socketpairs.
|
||||
|
||||
2006-09-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-util.c (_assuan_log_print_buffer)
|
||||
(_assuan_log_sanitized_string,assuan_set_log_stream): Moved to ..
|
||||
* assuan-logging.c: .. here.
|
||||
(_assuan_log_print_buffer): Only print the leading bytes in hex
|
||||
log mode unless the new env variable ASSUAN_FULL_LOGGING has been
|
||||
set.
|
||||
(_assuan_set_default_log_stream): Test this env variable.
|
||||
|
||||
2006-09-06 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan.h (_ASSUAN_ONLY_GPG_ERRORS): New.
|
||||
|
||||
* assuan-handler.c (dispatch_command): Use Syntax_Error instead of
|
||||
Invalid_Command.
|
||||
|
||||
* assuan-domain-connect.c: Changed alloc malloc/free/realloc to
|
||||
xtrymalloc et al.
|
||||
(read_int, write_int): Make args void pointers.
|
||||
(domain_receivefd): Take care of realloc shrinking failure.
|
||||
|
||||
* assuan-buffer.c (_assuan_read_line, _assuan_write_line)
|
||||
(assuan_write_line, _assuan_cookie_write_data)
|
||||
(_assuan_cookie_write_flush): Print the inbound fd instead of the
|
||||
address of the context when logging I/0. This makes it more
|
||||
readable.
|
||||
|
||||
2006-09-05 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-defs.h (err_code, err_is_eof): New.
|
||||
|
||||
* mkerrors (_assuan_error): New. Wrapped all error code
|
||||
assignments in a call to this.
|
||||
(assuan_strerror): Map gpg-style error codes back. Also print a
|
||||
string for the old EOF code.
|
||||
(assuan_set_assuan_err_source): New.
|
||||
|
||||
* assuan-logging.c (_assuan_log_printf): Do not change ERRNO and
|
||||
print the pid.
|
||||
|
||||
* assuan-domain-connect.c (domain_reader): Replaced plain printf
|
||||
by assuan_log function.
|
||||
|
||||
2005-10-24 Werner Koch <wk@g10code.com>
|
||||
|
||||
* putc_unlocked.c, memrchr.c, isascii.c, funopen.c: Changed
|
||||
distribution terms to LGPL. This are small and trivial files so
|
||||
there are no obstacles of doing so.
|
||||
* assuan-socket.c: Likewise, the stated GPL was not intended.
|
||||
|
||||
2005-10-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-defs.h (setenv, unsetenv, clearenv) [!HAVE_SETENV]:
|
||||
Define to _assuan_*.
|
||||
* setenv.c: Include "assuan-defs.h".
|
||||
(__add_to_environ): Make static.
|
||||
|
||||
2005-10-07 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-defs.h (memrchr) [!HAVE_MEMRCHR]: New prototype.
|
||||
(stpcpy) [!HAVE_STPCPY]: Likewise.
|
||||
* stpcpy.c: New LGPL'ed file from the GNU C Library.
|
||||
* setenv.c: New file.
|
||||
* assuan-domain-connect.c (read_int): New function.
|
||||
(write_int): New function.
|
||||
(domain_reader): Use read_int.
|
||||
(domain_sendfd): Use write_int.
|
||||
|
||||
2005-10-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan.h (assuan_pipe_connect, assuan_pipe_connect2): Make type
|
||||
of ARGV parameter const in prototype.
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect,
|
||||
assuan_pipe_connect2): Likewise in declaration.
|
||||
(assuan_pipe_connect2): Add braindead cast to make execv happy.
|
||||
|
||||
* assuan-client.c (assuan_transact): Change LINE, S and D from
|
||||
unsigned char * to char * to silence gcc warning.
|
||||
* assuan-util.c (_assuan_log_sanitized_string): Add explicit cast
|
||||
to silence gcc warning.
|
||||
* assuan-inquire.c (assuan_inquire): Likewise.
|
||||
|
||||
2005-08-19 Werner Koch <wk@g10code.com>
|
||||
|
||||
* funopen.c, assuan-socket.c: Copied from libassuan CVS.
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect2): Add missing
|
||||
declaration of PID.
|
||||
|
||||
2005-08-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* README.1st: Adjusted to cope with changes done in upstream Assuan.
|
||||
|
||||
Merged changes for W32 support from libassuan.
|
||||
|
||||
* assuan.h [_ASSUAN_EXT_SYM_PREFIX]: New.
|
||||
* assuan-io.c [_ASSUAN_NO_PTH]: New.
|
||||
* assuan-pipe-connect.c (fix_signals) [_ASSUAN_NO_FIXED_SIGNALS]: New.
|
||||
(assuan_pipe_connect2) [_ASSUAN_USE_DOUBLE_FORK]: Use double fork.
|
||||
(fix_signals) [_ASSUAN_USE_DOUBLE_FORK]: Do not wait..
|
||||
* assuan-logging.c, assuan-io.c: Include config.h
|
||||
Replaced all usages of _WIN32 by the new HAVE_W32_SYSTEM because
|
||||
there is nothing winning in this API.
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect2) [_WIN32]: Return
|
||||
error Not Imlemented.
|
||||
* assuan-logging.c (_assuan_w32_strerror): New.
|
||||
* assuan-defs.h (w32_strerror): new.
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect2, fix_signals):
|
||||
Factored signal code out to new function.
|
||||
(build_w32_commandline, create_inheritable_pipe): New. Taken
|
||||
from gnupg 1.9.
|
||||
(assuan_pipe_connect2) [W32]: Implemented for W32.
|
||||
* assuan-pipe-server.c (assuan_init_pipe_server) [W32]: Map file
|
||||
descriptors using _get_osfhandle.
|
||||
* assuan-socket-connect.c (assuan_socket_connect) [W32]: Allow for
|
||||
a drive letter in the path.
|
||||
* assuan-client.c (assuan_transact): Handle empty and comment
|
||||
commands correctly.
|
||||
* assuan-util.c (_assuan_calloc): Avoid integer overflow.
|
||||
* assuan-util.c (assuan_set_flag, assuan_get_flag): New.
|
||||
* assuan-defs.h (struct assuan_context_s): New field flags.
|
||||
* assuan.h (assuan_flag_t): New with one flag value
|
||||
ASSUAN_NO_WAITPID for now.
|
||||
* assuan-pipe-connect.c (do_finish): Take care of the no_waitpid
|
||||
flag.
|
||||
* mkerrors: Include config.h into assuan-errors.c. This is
|
||||
required so that assuan.h knows about the W32 macro.
|
||||
|
||||
2005-08-09 Timo Schulz <twoaday@g10code.com> (ported from libassuan by wk)
|
||||
|
||||
* assuan-io.c (_assuan_simple_read, _assuan_simple_write): W32
|
||||
support.
|
||||
* assuan-socket.c (_assuan_close): New.
|
||||
(_assuan_sock_new): New.
|
||||
(_assuan_sock_bind): New.
|
||||
|
||||
2005-03-22 Werner Koch <wk@g10code.com>
|
||||
|
||||
* assuan-defs.h (struct assuan_io): Renamed elements READ and
|
||||
WRITE to READFNC and WRITEFNC to avoid problems with read defined
|
||||
as macro. Changed callers. Noted by Ville Skyttä.
|
||||
|
||||
2004-12-16 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-pipe-connect.c (do_finish): Do not wait for child to finish.
|
||||
(assuan_pipe_connect): Use double-fork approach.
|
||||
* assuan-connect.c (assuan_disconnect): Do not write BYE to the
|
||||
status line.
|
||||
|
||||
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* README.1st: Add copyright notice.
|
||||
|
||||
2004-06-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-domain-connect.c [HAVE_SYS_UIO_H]: Include <sys/uio.h>.
|
||||
|
||||
* assuan-handler.c: Include <errno.h>.
|
||||
|
||||
2004-06-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-buffer.c (assuan_write_line): If the line is longer than
|
||||
the maximum line length, bail out early.
|
||||
|
||||
2004-04-21 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-socket-server.c (accept_connection_bottom): Save the pid
|
||||
of the peer if it is available.
|
||||
* assuan-socket-connect.c (assuan_socket_connect): Do not save the
|
||||
dummy SERVED_PID arg.
|
||||
* assuan-pipe-connect.c (do_finish): Don't wait if the pid is 0.
|
||||
(assuan_pipe_connect2): Store the parents pid in the environment
|
||||
of the child.
|
||||
* assuan-pipe-server.c (assuan_init_pipe_server): Initialize the
|
||||
peer's pid from the environment.
|
||||
* assuan-connect.c (assuan_get_pid): Do not return 0 as a PID.
|
||||
|
||||
2004-04-19 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-socket-server.c, assuan-socket-connect.c: Includes
|
||||
sys/types.h. Reported by Michael Nottebrock.
|
||||
* assuan-domain-connect.c: Ditto.
|
||||
|
||||
2004-04-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-util.c (_assuan_log_print_buffer): Relaxed quoting.
|
||||
(_assuan_log_sanitized_string): Ditto.
|
||||
|
||||
2004-03-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c: Include <errno.h>. Reported by Bernd Kuhls.
|
||||
|
||||
2004-02-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* libassuan-config.in: Ignore setting of --prefix.
|
||||
|
||||
* assuan-handler.c (assuan_get_data_fp): Fail with ENOSYS if we
|
||||
can't implement this.
|
||||
|
||||
2004-02-15 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* memrchr.c (memrchr): Fixed implementation. Taken from gpgme.
|
||||
|
||||
2004-02-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-domain-connect.c: Removed the unneeded alloca.h.
|
||||
|
||||
2004-01-24 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect2): New as an
|
||||
extension of assuan_pipe_connect. Made the latter call this one.
|
||||
|
||||
2004-01-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-buffer.c (_assuan_cookie_write_data): Return the
|
||||
requested size to indicate successful operation. Fixes a spurious
|
||||
bug we previously fixed using fflush().
|
||||
|
||||
2003-12-22 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan.h (ASSUAN_Locale_Problem): Added.
|
||||
* assuan-errors.c (assuan_strerror): Ditto.
|
||||
|
||||
2003-12-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan.h (AssuanCommand): Clarified that these are now
|
||||
deprecated and actually useless.
|
||||
(assuan_error_t): Clarified and added ASSUAN_USER_ERROR_FIRST,
|
||||
ASSUAN_USER_ERROR_LAST.
|
||||
|
||||
2003-12-16 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-buffer.c: Changed formatting of the debug output prefix.
|
||||
* assuan-util.c (assuan_set_log_stream): Set global log stream if
|
||||
it has not been done yet.
|
||||
* assuan-logging.c (_assuan_set_default_log_stream): New.
|
||||
(assuan_set_assuan_log_prefix): New.
|
||||
|
||||
2003-12-11 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* funopen.c (_assuan_funopen): Renamed from funopen, to keep the
|
||||
name space clean and avoid duplicate definitions if another
|
||||
library uses the same replacement.
|
||||
* assuan-defs.h (funopen): Renamed prototype and add a macro.
|
||||
|
||||
2003-12-08 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* TODO: Removed.
|
||||
|
||||
2003-11-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c (process_request): Kludge to print better error
|
||||
messages for gpg-error enabled programs.
|
||||
|
||||
2003-11-06 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan.h (assuan_context_t): New. Should be used in favor of
|
||||
ASSUAN_CONTEXT.
|
||||
(assuan_error_t): New. To be used instead of AssuanError.
|
||||
|
||||
2003-11-11 Moritz Schulte <mo@g10code.com>
|
||||
|
||||
* assuan-socket-connect.c (assuan_socket_connect): Fix computation
|
||||
of socket address length.
|
||||
|
||||
2003-08-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-inquire.c (assuan_inquire): Increase length of cmdbuf to
|
||||
the Assuan limit.
|
||||
|
||||
2003-06-24 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* mkerrors: Kludge to print libgpg-error values in an easier
|
||||
readable way.
|
||||
|
||||
2003-04-29 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* libassuan.m4: New. Based on libgrypt.m4.
|
||||
* Makefile.am (m4data_DATA): New.
|
||||
|
||||
* assuan.h (AssuanCommand): Removed.
|
||||
|
||||
* assuan-handler.c: Remove the cmd_id element,
|
||||
(assuan_register_command): Likewise. Note that semantics changed.
|
||||
(_assuan_register_std_commands): Adjusted.
|
||||
|
||||
2003-02-22 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* Makefile.am (bin_SCRIPTS): Renamed from bin_PROGRAMS.
|
||||
|
||||
2003-02-18 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* Makefile.am (libassuan_a_LIBADD): New variable.
|
||||
* funopen.c: Move from ../common.
|
||||
* isascii.c: Likewise.
|
||||
* memrchr.c: Likewise.
|
||||
* putc_unlocked.c: Likewise.
|
||||
|
||||
2003-02-18 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-handler.c (_IO_cookie_io_functions_t): Remove.
|
||||
(cookie_io_functions_t): Remove.
|
||||
(fopencookie): Remove prototype.
|
||||
(assuan_get_data_fp): Use funopen, not fopencookie.
|
||||
|
||||
2003-02-18 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* libassuan-config.in: New file.
|
||||
* Makefile.am (bin_PROGRAMS): New variable.
|
||||
|
||||
2003-02-17 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* .cvsignore: New file.
|
||||
|
||||
2003-02-17 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* Makefile.am (lib_LIBRARIES): Use this instead of . . .
|
||||
(noinst_LIBRARIES): . . . this.
|
||||
(include_HEADERS): New variable.
|
||||
(libassuan_a_SOURCES): Remove assuan.h, add assuan-logging.c.
|
||||
|
||||
* assuan.h (assuan_set_assuan_log_stream): New prototype.
|
||||
(assuan_get_assuan_log_stream): Likewise.
|
||||
(assuan_get_assuan_log_prefix): Likewise.
|
||||
* assuan-logging.c: New file.
|
||||
|
||||
* assuan-buffer.c [HAVE_JNLIB_LOGGIN]: Do not include
|
||||
"../jnlib/logging.h".
|
||||
(my_log_prefix): Remove function.
|
||||
(_assuan_read_line): Use assuan_get_assuan_log_prefix in lieu of
|
||||
my_log_prefix.
|
||||
(assuan_write_line): Likewise.
|
||||
(_assuan_cookie_write_data): Likewise.
|
||||
(_assuan_cookie_write_flush): Likewise.
|
||||
* assuan-domain-connect.c (LOGERROR, LOGERROR1, LOGERROR2,
|
||||
LOGERRORX): Remove.
|
||||
(LOG): New macro.
|
||||
(domain_reader): Use it.
|
||||
(domain_writer): Likewise.
|
||||
(domain_sendfd): Likewise.
|
||||
(domain_receivefd): Likewise.
|
||||
(_assuan_domain_init): Likewise.
|
||||
(assuan_domain_connect): Likewise.
|
||||
* assuan-pipe-connect.c [HAVE_JNLIB_LOGGIN]: Do not include
|
||||
"../jnlib/logging.h".
|
||||
(LOGERROR, LOGERROR1, LOGERROR2, LOGERRORX): Remove.
|
||||
(LOG): New macro.
|
||||
(assuan_pipe_connect): Use it.
|
||||
* assuan-socket-connect.c [HAVE_JNLIB_LOGGIN]: Do not include
|
||||
"../jnlib/logging.h".
|
||||
(LOGERROR, LOGERROR1, LOGERROR2, LOGERRORX): Remove.
|
||||
(LOG): New macro.
|
||||
(assuan_socket_connect): Use it.
|
||||
(socket_reader): Remove dead code.
|
||||
(socket_writer): Likewise.
|
||||
* assuan-util.c [HAVE_JNLIB_LOGGIN]: Do not include
|
||||
"../jnlib/logging.h".
|
||||
(_assuan_log_sanitized_string): Use assuan_get_assuan_log_stream,
|
||||
not jnlib.
|
||||
|
||||
2002-11-24 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan.h (assuan_command_parse_fd): New prototype.
|
||||
* assuan-handler.c (assuan_command_parse_fd): Rename from
|
||||
parse_cmd_input_output. Export.
|
||||
(std_handler_input): Update to use assuan_command_parse_fd.
|
||||
(std_handler_output): Likewise.
|
||||
|
||||
2002-11-24 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan.h (assuan_sendfd): New prototype.
|
||||
(assuan_receivefd): New prototype.
|
||||
* assuan-buffer.c (assuan_sendfd): New function.
|
||||
(assuan_receivefd): New function.
|
||||
* assuan-handler.c (parse_cmd_input_output): Recognize incoming
|
||||
file descriptors and act appropriately.
|
||||
* assuan-defs.h (struct assuan_io): Add fields sendfd and
|
||||
receivefd.
|
||||
(struct assuan_context_s): Add fields pendingfds and
|
||||
pendingfdscount.
|
||||
* assuan-pipe-server.c (_assuan_new_context): Update IO to reflect
|
||||
new features.
|
||||
* assuan-domain-connect.c (do_deinit): Cleanup any unreceived file
|
||||
descriptors.
|
||||
(domain_reader): Receive file descriptors.
|
||||
(domain_sendfd): New function.
|
||||
(domain_receivefd): New function.
|
||||
(_assuan_domain_init): Update initialization code to reflect new
|
||||
features.
|
||||
|
||||
2002-11-24 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-domain-connect.c (do_finish): Remove.
|
||||
(_assuan_domain_init): Use default handlers where possible.
|
||||
Add an assert and update comments.
|
||||
* assuan-domain-server.c (accept_connection): Remove.
|
||||
(assuan_init_domain_server): Use default handlers where possible.
|
||||
Put the server in pipe mode: it can only be used by a single
|
||||
client.
|
||||
|
||||
2002-11-24 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan.h: Add prototype for assuan_domain_connect and
|
||||
assuan_init_domain_server.
|
||||
* assuan-defs.h: Include <unistd.h>.
|
||||
Add prototype for _assuan_domain_init.
|
||||
* assuan-domain-connect.c: New file.
|
||||
* assuan-domain-server.c: New file.
|
||||
* Makefile.am (libassuan_a_SOURCES): Add assuan-domain-connect.c
|
||||
and assuan-domain-server.c
|
||||
|
||||
2002-11-23 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* Makefile.am (libassuan_a_SOURCES): Add assuan-io.c.
|
||||
* assuan-io.c: Restore.
|
||||
(_assuan_simple_read): Rename from _assuan_read.
|
||||
(_assuan_simple_write): Rename from _assuan_write.
|
||||
* assuan-defs.h (_assuan_simple_read): New prototype.
|
||||
(_assuan_simple_write): Likewise.
|
||||
* assuan-pipe-server.c (pipe_reader): Remove.
|
||||
(pipe_writer): Remove.
|
||||
(_assuan_new_context): Initialize IO is with _assuan_simple_read
|
||||
and _assuan_simple_write.
|
||||
* assuan-socket-connect.c (socket_reader): Remove.
|
||||
(socket_writer): Remove.
|
||||
(assuan_socket_connect): Initialize IO is with _assuan_simple_read
|
||||
and _assuan_simple_write.
|
||||
* assuan-socket-server.c (io): New local variable.
|
||||
(assuan_init_socket_server): Initialize CTX->io.
|
||||
(assuan_init_connected_socket_server): Likewise.
|
||||
|
||||
2002-11-23 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-buffer.c (readline): Use memrchr.
|
||||
(_assuan_read_line): Rewritten to use the string functions.
|
||||
|
||||
2002-11-20 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-socket-connect.c (assuan_socket_connect): Pass PF_LOCAL
|
||||
to socket(), not AF_UNIX: it expects a PF_* macro and the former
|
||||
is more portable.
|
||||
(assuan_socket_connect): Use AF_LOCAL, not AF_UNIX which is more
|
||||
POSIXy.
|
||||
|
||||
2002-11-20 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-defs.h (struct assuan_io): New structure.
|
||||
(struct assuan_context_s): New field, io.
|
||||
(_assuan_read): Depreciated.
|
||||
(_assuan_write): Likewise.
|
||||
* assuan-pipe-server.c: Include <unistd.h>.
|
||||
(pipe_reader): New function.
|
||||
(pipe_writer): Likewise.
|
||||
(_assuan_new_context.IO): New local static. Set to pipe_reader
|
||||
and pipe_writer. Use it to initialize new context.
|
||||
* assuan-socket-connect.c (socket_reader): New function.
|
||||
(socket_writer): New function.
|
||||
(assuan_socket_connect.IO): New local static. Set to socket_reader
|
||||
and socket_writer. Use it to initialize new context.
|
||||
* assuan-buffer.c (writen): Take an ASSUAN_CONTEXT rather than a
|
||||
file descriptor. Do not use _assuan_write but the write method
|
||||
in the supplied context.
|
||||
(readline): Likewise for _assuan_read.
|
||||
(assuan_write_line): When calling writen, pass CTX; not the file
|
||||
descriptor directly.
|
||||
(_assuan_cookie_write_data): Likewise.
|
||||
(_assuan_cookie_write_flush): Likewise.
|
||||
(_assuan_read_line): Likewise for readline.
|
||||
* Makefile.am (libassuan_a_SOURCES): Remove assuan-io.c.
|
||||
* assuan-io.c: Removed.
|
||||
|
||||
2002-11-10 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect): Changed the order
|
||||
of the dups to handle cases where we have already used fd 2 for
|
||||
other things.
|
||||
|
||||
2002-10-31 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-util.c: Include <ctype.h>.
|
||||
(_assuan_log_print_buffer): Elide the magic numbers preferring the
|
||||
standard isfoo functions. Use putc_unlocked where possible.
|
||||
(_assuan_log_sanitized_string): Rewrite to use putc_unlocked and
|
||||
the isfoo functions.
|
||||
|
||||
2002-09-05 Neal H. Walfield <neal@g10code.de>
|
||||
|
||||
* assuan-defs.h (_assuan_read_wrapper): Depreciated.
|
||||
* assuan-util.c (_assuan_read_wrapper): Removed.
|
||||
* assuan-defs.h (_assuan_write_wrapper): Depreciated.
|
||||
* assuan-util.c (_assuan_write_wrapper): Removed.
|
||||
* assuan.h (assuan_set_io_fun): Depreciated.
|
||||
* assuan-util.c (assuan_set_io_fun): Removed.
|
||||
|
||||
* assuan-defs.h (_assuan_read): New function.
|
||||
(_assuan_write): Likewise.
|
||||
* assuan-io.c: New file.
|
||||
|
||||
* assuan-buffer.c (writen): Use _assuan_write rather than doing
|
||||
the work here.
|
||||
(readline): Likewise for _assuan_read.
|
||||
|
||||
* Makefile.am (libassuan_a_SOURCES): Add assuan-io.c.
|
||||
|
||||
2002-08-16 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan.h: Renamed Bad_Certificate_Path to Bad_Certificate_Chain.
|
||||
|
||||
2002-07-30 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Changed the license from GPL to LGPL.
|
||||
|
||||
2002-07-23 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c (_IO_cookie_io_functions_t): Define it here if
|
||||
it does not exists.
|
||||
|
||||
2002-06-27 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-pipe-connect.c (assuan_pipe_connect): No special handling
|
||||
for the log_fd and stderr. Connect stderr to /dev/null if it
|
||||
should not be retained.
|
||||
|
||||
2002-06-26 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-buffer.c (assuan_write_line): Make sure we never
|
||||
accidently print an extra LF.
|
||||
|
||||
2002-05-23 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-util.c (assuan_set_io_func): New.
|
||||
* assuan-buffer.c (writen, readline): Use the new functions
|
||||
instead of pth.
|
||||
* assuan-socket-server.c (accept_connection): Don't use the
|
||||
pth_accept - using the assuan included accept code would be a bad
|
||||
idea within Pth so we don't need a replacement function.
|
||||
|
||||
2002-05-22 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-socket-server.c (assuan_init_connected_socket_server): New.
|
||||
(accept_connection): Factored most code out to..
|
||||
(accept_connection_bottom): .. new function.
|
||||
|
||||
2002-04-04 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-buffer.c (my_log_prefix): New. Use it for all i/o debug
|
||||
output.
|
||||
|
||||
2002-03-06 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-client.c (_assuan_read_from_server): Detect END.
|
||||
(assuan_transact): Pass it to the data callback.
|
||||
|
||||
2002-02-27 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-client.c (assuan_transact): Add 2 more arguments to
|
||||
support status lines. Passing NULL yields the old behaviour.
|
||||
|
||||
* assuan-handler.c (process_request): Flush data lines send
|
||||
without using the data fp.
|
||||
|
||||
2002-02-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-inquire.c (assuan_inquire): Check for a cancel command
|
||||
and return ASSUAN_Canceled. Allow for non-data inquiry.
|
||||
|
||||
* assuan.h: Add a few token specific error codes.
|
||||
|
||||
2002-02-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-defs.h (assuan_context_s): New var CLIENT_PID.
|
||||
* assuan-pipe-server.c (_assuan_new_context): set default value.
|
||||
* assuan-socket-server.c (accept_connection): get the actual pid.
|
||||
|
||||
2002-02-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-buffer.c (writen,readline) [USE_GNU_PT]: Use pth_read/write.
|
||||
* assuan-socket-server.c (accept_connection) [USE_GNU_PTH]: Ditto.
|
||||
|
||||
2002-02-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (MOSTLYCLEANFILES): New variable.
|
||||
|
||||
2002-01-23 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-socket-connect.c (LOGERRORX): and removed typo.
|
||||
|
||||
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-socket-connect.c (LOGERRORX): Reverse arguments to fputs.
|
||||
|
||||
2002-01-21 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-connect.c: Move all except assuan_get_pid to...
|
||||
* assuan-pipe-connect.c: this.
|
||||
(assuan_pipe_disconnect): Removed.
|
||||
(do_finish, do_deinit): New
|
||||
(assuan_pipe_connect): and set them into the context.
|
||||
* assuan-socket-connect.c: New.
|
||||
|
||||
* assuan-util.c (_assuan_log_sanitized_string): New.
|
||||
|
||||
* assuan-pipe-server.c (assuan_init_pipe_server): Factored most
|
||||
code out to ...
|
||||
(_assuan_new_context): new func.
|
||||
(_assuan_release_context): New
|
||||
* assuan-connect.c (assuan_pipe_connect): Use the new functions.
|
||||
|
||||
2002-01-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan.h: Added Invalid Option error code.
|
||||
|
||||
* assuan-handler.c (std_handler_option): New.
|
||||
(std_cmd_tbl): Add OPTION as standard command.
|
||||
(assuan_register_option_handler): New.
|
||||
(dispatch_command): Use case insensitive matching as a fallback.
|
||||
(my_strcasecmp): New.
|
||||
|
||||
2002-01-19 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-buffer.c (_assuan_read_line): Add output logging.
|
||||
(assuan_write_line): Ditto.
|
||||
(_assuan_cookie_write_data): Ditto.
|
||||
(_assuan_cookie_write_flush): Ditto.
|
||||
* assuan-util.c (_assuan_log_print_buffer): New.
|
||||
(assuan_set_log_stream): New.
|
||||
(assuan_begin_confidential): New.
|
||||
(assuan_end_confidential): New.
|
||||
|
||||
* assuan-defs.h: Add a few handler variables.
|
||||
* assuan-pipe-server.c (assuan_deinit_pipe_server): Removed.
|
||||
(deinit_pipe_server): New.
|
||||
(assuan_deinit_server): New. Changed all callers to use this.
|
||||
* assuan-listen.c (assuan_accept): Use the accept handler.
|
||||
* assuan-handler.c (process_request): Use the close Handler.
|
||||
* assuan-socket-server.c: New.
|
||||
|
||||
2002-01-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-client.c (_assuan_read_from_server): Skip spaces after
|
||||
the keyword.
|
||||
|
||||
2002-01-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c (assuan_set_okay_line): New.
|
||||
(process_request): And use it here.
|
||||
|
||||
2002-01-02 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-inquire.c (init_membuf,put_membuf,get_membuf): Apply a
|
||||
hidden 0 behind the buffer so that the buffer can be used as a
|
||||
string in certain contexts.
|
||||
|
||||
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-connect.c (assuan_pipe_connect): New argument
|
||||
FD_CHILD_LIST. Don't close those fds.
|
||||
* assuan.h: Likewise for prototype.
|
||||
|
||||
2001-12-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-listen.c (assuan_close_input_fd): New.
|
||||
(assuan_close_output_fd): New.
|
||||
* assuan-handler.c (std_handler_reset): Always close them after a
|
||||
reset command.
|
||||
(std_handler_bye): Likewise.
|
||||
|
||||
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-buffer.c (_assuan_read_line): New variable ATTICLEN, use
|
||||
it to save the length of the attic line.
|
||||
Rediddle the code a bit to make it more clear what happens.
|
||||
|
||||
2001-12-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-defs.h (LINELENGTH): Define as ASSUAN_LINELENGTH.
|
||||
assuan.h: Define ASSUAN_LINELENGTH.
|
||||
|
||||
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* assuan-buffer.c (assuan_read_line): Fix order of execution to
|
||||
get correct return values.
|
||||
|
||||
2001-12-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c (assuan_get_active_fds): Fixed silly bug,
|
||||
pretty obvious that nobody ever tested this function.
|
||||
|
||||
2001-12-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-connect.c (assuan_pipe_connect): Implemented the inital
|
||||
handshake.
|
||||
* assuan-client.c (read_from_server): Renamed to
|
||||
(_assuan_read_from_server): this and made external.
|
||||
|
||||
* assuan-listen.c (assuan_set_hello_line): New.
|
||||
(assuan_accept): Use a custom hello line is available.
|
||||
|
||||
* assuan-buffer.c (assuan_read_line): New.
|
||||
(assuan_pending_line): New.
|
||||
(_assuan_write_line): Renamed to ..
|
||||
(assuan_write_line): this, made public and changed all callers.
|
||||
|
||||
2001-12-04 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-connect.c (assuan_pipe_connect): Add more error reporting.
|
||||
* assuan-client.c: New.
|
||||
|
||||
* assuan-inquire.c: New.
|
||||
* assuan-handler.c (process_request): Check for nested invocations.
|
||||
|
||||
2001-11-27 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c (assuan_register_input_notify): New.
|
||||
(assuan_register_output_notify): New.
|
||||
|
||||
2001-11-26 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan.h: Added more status codes.
|
||||
|
||||
2001-11-25 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-handler.c (assuan_register_bye_notify)
|
||||
(assuan_register_reset_notify)
|
||||
(assuan_register_cancel_notify): New and call them from the
|
||||
standard handlers.
|
||||
(assuan_process): Moved bulk of function to ..
|
||||
(process_request): .. new.
|
||||
(assuan_process_next): One shot version of above.
|
||||
(assuan_get_active_fds): New.
|
||||
|
||||
2001-11-24 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* assuan-connect.c (assuan_get_pid): New.
|
||||
|
||||
* assuan-buffer.c (_assuan_read_line): Deal with reads of more
|
||||
than a line.
|
||||
* assuan-defs.h: Add space in the context for this.
|
||||
|
||||
|
||||
Copyright 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
53
tags/gpgme-1.1.5/assuan/Makefile.am
Normal file
53
tags/gpgme-1.1.5/assuan/Makefile.am
Normal file
@ -0,0 +1,53 @@
|
||||
# Assuan Makefile
|
||||
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of Assuan.
|
||||
#
|
||||
# Assuan is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# Assuan is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = mkerrors
|
||||
INCLUDES = -I.. -I$(top_srcdir)/gpgme
|
||||
BUILT_SOURCES = assuan-errors.c
|
||||
MOSTLYCLEANFILES = assuan-errors.c
|
||||
|
||||
noinst_LTLIBRARIES = libassuan.la
|
||||
|
||||
AM_CPPFLAGS = -D_ASSUAN_IN_GPGME_BUILD_ASSUAN
|
||||
|
||||
#libassuan_la_LDFLAGS =
|
||||
libassuan_la_SOURCES = \
|
||||
assuan.h \
|
||||
assuan-defs.h \
|
||||
assuan-util.c \
|
||||
assuan-errors.c \
|
||||
assuan-buffer.c \
|
||||
assuan-handler.c \
|
||||
assuan-inquire.c \
|
||||
assuan-listen.c \
|
||||
assuan-connect.c \
|
||||
assuan-client.c \
|
||||
assuan-pipe-server.c \
|
||||
assuan-socket-server.c \
|
||||
assuan-pipe-connect.c \
|
||||
assuan-socket-connect.c \
|
||||
assuan-uds.c \
|
||||
assuan-io.c \
|
||||
assuan-logging.c \
|
||||
assuan-socket.c
|
||||
|
||||
assuan-errors.c : assuan.h mkerrors
|
||||
$(srcdir)/mkerrors < $(srcdir)/assuan.h > assuan-errors.c
|
38
tags/gpgme-1.1.5/assuan/README.1st
Normal file
38
tags/gpgme-1.1.5/assuan/README.1st
Normal file
@ -0,0 +1,38 @@
|
||||
This is a modified copy of the libassuan library. Don't modify it,
|
||||
but instead modify the original Assuan library and merge the changes
|
||||
back into this copy.
|
||||
|
||||
The changes to the original libassuan, that have to preserved when
|
||||
updating this directory, are:
|
||||
|
||||
* Makefile.am
|
||||
** Build the library with libtool as a convenience library, which can
|
||||
be linked into the shared library GPGME.
|
||||
** Do not install the library or the header file.
|
||||
** Define -D_ASSUAN_IN_GPGME_BUILD_ASSUAN to wrap some POSIX functions
|
||||
with ATH replacements.
|
||||
|
||||
* assuan.h
|
||||
** Preserve the block between "Begin/End GPGME specific modifications".
|
||||
In particular make sure that
|
||||
#define _ASSUAN_EXT_SYM_PREFIX _gpgme_
|
||||
#define _ASSUAN_NO_PTH
|
||||
#define _ASSUAN_NO_FIXED_SIGNALS
|
||||
#define _ASSUAN_USE_DOUBLE_FORK
|
||||
are defined. This puts all exported Assuan functions in the _gpgme
|
||||
namespace. It also wraps all system functions that are wrapped by
|
||||
GNU Pth to _gpgme wrappers.
|
||||
|
||||
* assuan-io-pth.c
|
||||
We don't need this file as GPGME doesn't use sendmsg and recvmsg.
|
||||
If it would, we would need to pick up the W32 implementation.
|
||||
|
||||
Copyright 2004 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
550
tags/gpgme-1.1.5/assuan/assuan-buffer.c
Normal file
550
tags/gpgme-1.1.5/assuan/assuan-buffer.c
Normal file
@ -0,0 +1,550 @@
|
||||
/* assuan-buffer.c - read and send data
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
#include <process.h>
|
||||
#endif
|
||||
#include "assuan-defs.h"
|
||||
|
||||
|
||||
/* Extended version of write(2) to guarantee that all bytes are
|
||||
written. Returns 0 on success or -1 and ERRNO on failure. */
|
||||
static int
|
||||
writen (assuan_context_t ctx, const char *buffer, size_t length)
|
||||
{
|
||||
while (length)
|
||||
{
|
||||
ssize_t nwritten = ctx->io->writefnc (ctx, buffer, length);
|
||||
|
||||
if (nwritten < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
return -1; /* write error */
|
||||
}
|
||||
length -= nwritten;
|
||||
buffer += nwritten;
|
||||
}
|
||||
return 0; /* okay */
|
||||
}
|
||||
|
||||
/* Read an entire line. Returns 0 on success or -1 and ERRNo on
|
||||
failure. EOF is indictated by setting the integer at address
|
||||
R_EOF. */
|
||||
static int
|
||||
readline (assuan_context_t ctx, char *buf, size_t buflen,
|
||||
int *r_nread, int *r_eof)
|
||||
{
|
||||
size_t nleft = buflen;
|
||||
char *p;
|
||||
|
||||
*r_eof = 0;
|
||||
*r_nread = 0;
|
||||
while (nleft > 0)
|
||||
{
|
||||
ssize_t n = ctx->io->readfnc (ctx, buf, nleft);
|
||||
|
||||
if (n < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
return -1; /* read error */
|
||||
}
|
||||
else if (!n)
|
||||
{
|
||||
*r_eof = 1;
|
||||
break; /* allow incomplete lines */
|
||||
}
|
||||
p = buf;
|
||||
nleft -= n;
|
||||
buf += n;
|
||||
*r_nread += n;
|
||||
|
||||
p = memrchr (p, '\n', n);
|
||||
if (p)
|
||||
break; /* at least one full line available - that's enough for now */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Function returns an Assuan error. */
|
||||
assuan_error_t
|
||||
_assuan_read_line (assuan_context_t ctx)
|
||||
{
|
||||
char *line = ctx->inbound.line;
|
||||
int nread, atticlen;
|
||||
int rc;
|
||||
char *endp = 0;
|
||||
|
||||
if (ctx->inbound.eof)
|
||||
return _assuan_error (-1);
|
||||
|
||||
atticlen = ctx->inbound.attic.linelen;
|
||||
if (atticlen)
|
||||
{
|
||||
memcpy (line, ctx->inbound.attic.line, atticlen);
|
||||
ctx->inbound.attic.linelen = 0;
|
||||
|
||||
endp = memchr (line, '\n', atticlen);
|
||||
if (endp)
|
||||
/* Found another line in the attic. */
|
||||
{
|
||||
rc = 0;
|
||||
nread = atticlen;
|
||||
atticlen = 0;
|
||||
}
|
||||
else
|
||||
/* There is pending data but not a full line. */
|
||||
{
|
||||
assert (atticlen < LINELENGTH);
|
||||
rc = readline (ctx, line + atticlen,
|
||||
LINELENGTH - atticlen, &nread, &ctx->inbound.eof);
|
||||
}
|
||||
}
|
||||
else
|
||||
/* No pending data. */
|
||||
rc = readline (ctx, line, LINELENGTH,
|
||||
&nread, &ctx->inbound.eof);
|
||||
if (rc)
|
||||
{
|
||||
if (ctx->log_fp)
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Error: %s]\n",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd,
|
||||
strerror (errno));
|
||||
return _assuan_error (ASSUAN_Read_Error);
|
||||
}
|
||||
if (!nread)
|
||||
{
|
||||
assert (ctx->inbound.eof);
|
||||
if (ctx->log_fp)
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [EOF]\n",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
return _assuan_error (-1);
|
||||
}
|
||||
|
||||
ctx->inbound.attic.pending = 0;
|
||||
nread += atticlen;
|
||||
|
||||
if (! endp)
|
||||
endp = memchr (line, '\n', nread);
|
||||
|
||||
if (endp)
|
||||
{
|
||||
unsigned monitor_result;
|
||||
int n = endp - line + 1;
|
||||
|
||||
if (n < nread)
|
||||
/* LINE contains more than one line. We copy it to the attic
|
||||
now as handlers are allowed to modify the passed
|
||||
buffer. */
|
||||
{
|
||||
int len = nread - n;
|
||||
memcpy (ctx->inbound.attic.line, endp + 1, len);
|
||||
ctx->inbound.attic.pending = memrchr (endp + 1, '\n', len) ? 1 : 0;
|
||||
ctx->inbound.attic.linelen = len;
|
||||
}
|
||||
|
||||
if (endp != line && endp[-1] == '\r')
|
||||
endp --;
|
||||
*endp = 0;
|
||||
|
||||
ctx->inbound.linelen = endp - line;
|
||||
|
||||
monitor_result = (ctx->io_monitor
|
||||
? ctx->io_monitor (ctx, 0,
|
||||
ctx->inbound.line,
|
||||
ctx->inbound.linelen)
|
||||
: 0);
|
||||
if ( (monitor_result & 2) )
|
||||
ctx->inbound.linelen = 0;
|
||||
|
||||
if (ctx->log_fp && !(monitor_result & 1))
|
||||
{
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- ",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
if (ctx->confidential)
|
||||
fputs ("[Confidential data not shown]", ctx->log_fp);
|
||||
else
|
||||
_assuan_log_print_buffer (ctx->log_fp,
|
||||
ctx->inbound.line,
|
||||
ctx->inbound.linelen);
|
||||
putc ('\n', ctx->log_fp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ctx->log_fp)
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: <- [Invalid line]\n",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
*line = 0;
|
||||
ctx->inbound.linelen = 0;
|
||||
return _assuan_error (ctx->inbound.eof
|
||||
? ASSUAN_Line_Not_Terminated
|
||||
: ASSUAN_Line_Too_Long);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read the next line from the client or server and return a pointer
|
||||
in *LINE to a buffer holding the line. LINELEN is the length of
|
||||
*LINE. The buffer is valid until the next read operation on it.
|
||||
The caller may modify the buffer. The buffer is invalid (i.e. must
|
||||
not be used) if an error is returned.
|
||||
|
||||
Returns 0 on success or an assuan error code.
|
||||
See also: assuan_pending_line().
|
||||
*/
|
||||
assuan_error_t
|
||||
assuan_read_line (assuan_context_t ctx, char **line, size_t *linelen)
|
||||
{
|
||||
assuan_error_t err;
|
||||
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
err = _assuan_read_line (ctx);
|
||||
*line = ctx->inbound.line;
|
||||
*linelen = ctx->inbound.linelen;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Return true if a full line is buffered (i.e. an entire line may be
|
||||
read without any I/O). */
|
||||
int
|
||||
assuan_pending_line (assuan_context_t ctx)
|
||||
{
|
||||
return ctx && ctx->inbound.attic.pending;
|
||||
}
|
||||
|
||||
|
||||
assuan_error_t
|
||||
_assuan_write_line (assuan_context_t ctx, const char *prefix,
|
||||
const char *line, size_t len)
|
||||
{
|
||||
assuan_error_t rc = 0;
|
||||
size_t prefixlen = prefix? strlen (prefix):0;
|
||||
unsigned int monitor_result;
|
||||
|
||||
/* Make sure that the line is short enough. */
|
||||
if (len + prefixlen + 2 > ASSUAN_LINELENGTH)
|
||||
{
|
||||
if (ctx->log_fp)
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> "
|
||||
"[supplied line too long -truncated]\n",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
if (prefixlen > 5)
|
||||
prefixlen = 5;
|
||||
if (len > ASSUAN_LINELENGTH - prefixlen - 2)
|
||||
len = ASSUAN_LINELENGTH - prefixlen - 2 - 1;
|
||||
}
|
||||
|
||||
monitor_result = (ctx->io_monitor
|
||||
? ctx->io_monitor (ctx, 1, line, len)
|
||||
: 0);
|
||||
|
||||
/* Fixme: we should do some kind of line buffering. */
|
||||
if (ctx->log_fp && !(monitor_result & 1))
|
||||
{
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
if (ctx->confidential)
|
||||
fputs ("[Confidential data not shown]", ctx->log_fp);
|
||||
else
|
||||
{
|
||||
if (prefixlen)
|
||||
_assuan_log_print_buffer (ctx->log_fp, prefix, prefixlen);
|
||||
_assuan_log_print_buffer (ctx->log_fp, line, len);
|
||||
}
|
||||
putc ('\n', ctx->log_fp);
|
||||
}
|
||||
|
||||
if (prefixlen && !(monitor_result & 2))
|
||||
{
|
||||
rc = writen (ctx, prefix, prefixlen);
|
||||
if (rc)
|
||||
rc = _assuan_error (ASSUAN_Write_Error);
|
||||
}
|
||||
if (!rc && !(monitor_result & 2))
|
||||
{
|
||||
rc = writen (ctx, line, len);
|
||||
if (rc)
|
||||
rc = _assuan_error (ASSUAN_Write_Error);
|
||||
if (!rc)
|
||||
{
|
||||
rc = writen (ctx, "\n", 1);
|
||||
if (rc)
|
||||
rc = _assuan_error (ASSUAN_Write_Error);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
assuan_error_t
|
||||
assuan_write_line (assuan_context_t ctx, const char *line)
|
||||
{
|
||||
size_t len;
|
||||
const char *s;
|
||||
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
/* Make sure that we never take a LF from the user - this might
|
||||
violate the protocol. */
|
||||
s = strchr (line, '\n');
|
||||
len = s? (s-line) : strlen (line);
|
||||
|
||||
if (ctx->log_fp && s)
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> "
|
||||
"[supplied line contained a LF - truncated]\n",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
|
||||
return _assuan_write_line (ctx, NULL, line, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Write out the data in buffer as datalines with line wrapping and
|
||||
percent escaping. This function is used for GNU's custom streams. */
|
||||
int
|
||||
_assuan_cookie_write_data (void *cookie, const char *buffer, size_t orig_size)
|
||||
{
|
||||
assuan_context_t ctx = cookie;
|
||||
size_t size = orig_size;
|
||||
char *line;
|
||||
size_t linelen;
|
||||
|
||||
if (ctx->outbound.data.error)
|
||||
return 0;
|
||||
|
||||
line = ctx->outbound.data.line;
|
||||
linelen = ctx->outbound.data.linelen;
|
||||
line += linelen;
|
||||
while (size)
|
||||
{
|
||||
unsigned int monitor_result;
|
||||
|
||||
/* Insert data line header. */
|
||||
if (!linelen)
|
||||
{
|
||||
*line++ = 'D';
|
||||
*line++ = ' ';
|
||||
linelen += 2;
|
||||
}
|
||||
|
||||
/* Copy data, keep space for the CRLF and to escape one character. */
|
||||
while (size && linelen < LINELENGTH-2-2)
|
||||
{
|
||||
if (*buffer == '%' || *buffer == '\r' || *buffer == '\n')
|
||||
{
|
||||
sprintf (line, "%%%02X", *(unsigned char*)buffer);
|
||||
line += 3;
|
||||
linelen += 3;
|
||||
buffer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*line++ = *buffer++;
|
||||
linelen++;
|
||||
}
|
||||
size--;
|
||||
}
|
||||
|
||||
|
||||
monitor_result = (ctx->io_monitor
|
||||
? ctx->io_monitor (ctx, 1,
|
||||
ctx->outbound.data.line, linelen)
|
||||
: 0);
|
||||
|
||||
if (linelen >= LINELENGTH-2-2)
|
||||
{
|
||||
if (ctx->log_fp && !(monitor_result & 1))
|
||||
{
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
|
||||
if (ctx->confidential)
|
||||
fputs ("[Confidential data not shown]", ctx->log_fp);
|
||||
else
|
||||
_assuan_log_print_buffer (ctx->log_fp,
|
||||
ctx->outbound.data.line,
|
||||
linelen);
|
||||
putc ('\n', ctx->log_fp);
|
||||
}
|
||||
*line++ = '\n';
|
||||
linelen++;
|
||||
if ( !(monitor_result & 2)
|
||||
&& writen (ctx, ctx->outbound.data.line, linelen))
|
||||
{
|
||||
ctx->outbound.data.error = _assuan_error (ASSUAN_Write_Error);
|
||||
return 0;
|
||||
}
|
||||
line = ctx->outbound.data.line;
|
||||
linelen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->outbound.data.linelen = linelen;
|
||||
return (int)orig_size;
|
||||
}
|
||||
|
||||
|
||||
/* Write out any buffered data
|
||||
This function is used for GNU's custom streams */
|
||||
int
|
||||
_assuan_cookie_write_flush (void *cookie)
|
||||
{
|
||||
assuan_context_t ctx = cookie;
|
||||
char *line;
|
||||
size_t linelen;
|
||||
unsigned int monitor_result;
|
||||
|
||||
if (ctx->outbound.data.error)
|
||||
return 0;
|
||||
|
||||
line = ctx->outbound.data.line;
|
||||
linelen = ctx->outbound.data.linelen;
|
||||
line += linelen;
|
||||
|
||||
monitor_result = (ctx->io_monitor
|
||||
? ctx->io_monitor (ctx, 1,
|
||||
ctx->outbound.data.line, linelen)
|
||||
: 0);
|
||||
|
||||
if (linelen)
|
||||
{
|
||||
if (ctx->log_fp && !(monitor_result & 1))
|
||||
{
|
||||
fprintf (ctx->log_fp, "%s[%u.%d] DBG: -> ",
|
||||
assuan_get_assuan_log_prefix (),
|
||||
(unsigned int)getpid (), ctx->inbound.fd);
|
||||
if (ctx->confidential)
|
||||
fputs ("[Confidential data not shown]", ctx->log_fp);
|
||||
else
|
||||
_assuan_log_print_buffer (ctx->log_fp,
|
||||
ctx->outbound.data.line, linelen);
|
||||
putc ('\n', ctx->log_fp);
|
||||
}
|
||||
*line++ = '\n';
|
||||
linelen++;
|
||||
if ( !(monitor_result & 2)
|
||||
&& writen (ctx, ctx->outbound.data.line, linelen))
|
||||
{
|
||||
ctx->outbound.data.error = _assuan_error (ASSUAN_Write_Error);
|
||||
return 0;
|
||||
}
|
||||
ctx->outbound.data.linelen = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assuan_send_data:
|
||||
* @ctx: An assuan context
|
||||
* @buffer: Data to send or NULL to flush
|
||||
* @length: length of the data to send/
|
||||
*
|
||||
* This function may be used by the server or the client to send data
|
||||
* lines. The data will be escaped as required by the Assuan protocol
|
||||
* and may get buffered until a line is full. To force sending the
|
||||
* data out @buffer may be passed as NULL (in which case @length must
|
||||
* also be 0); however when used by a client this flush operation does
|
||||
* also send the terminating "END" command to terminate the reponse on
|
||||
* a INQUIRE response. However, when assuan_transact() is used, this
|
||||
* function takes care of sending END itself.
|
||||
*
|
||||
* Return value: 0 on success or an error code
|
||||
**/
|
||||
|
||||
assuan_error_t
|
||||
assuan_send_data (assuan_context_t ctx, const void *buffer, size_t length)
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
if (!buffer && length)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
if (!buffer)
|
||||
{ /* flush what we have */
|
||||
_assuan_cookie_write_flush (ctx);
|
||||
if (ctx->outbound.data.error)
|
||||
return ctx->outbound.data.error;
|
||||
if (!ctx->is_server)
|
||||
return assuan_write_line (ctx, "END");
|
||||
}
|
||||
else
|
||||
{
|
||||
_assuan_cookie_write_data (ctx, buffer, length);
|
||||
if (ctx->outbound.data.error)
|
||||
return ctx->outbound.data.error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
assuan_error_t
|
||||
assuan_sendfd (assuan_context_t ctx, int fd)
|
||||
{
|
||||
/* It is explicitly allowed to use (NULL, -1) as a runtime test to
|
||||
check whether descriptor passing is available. */
|
||||
if (!ctx && fd == -1)
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
return 0;
|
||||
#else
|
||||
return _assuan_error (ASSUAN_Not_Implemented);
|
||||
#endif
|
||||
|
||||
if (! ctx->io->sendfd)
|
||||
return set_error (ctx, Not_Implemented,
|
||||
"server does not support sending and receiving "
|
||||
"of file descriptors");
|
||||
return ctx->io->sendfd (ctx, fd);
|
||||
}
|
||||
|
||||
assuan_error_t
|
||||
assuan_receivefd (assuan_context_t ctx, int *fd)
|
||||
{
|
||||
if (! ctx->io->receivefd)
|
||||
return set_error (ctx, Not_Implemented,
|
||||
"server does not support sending and receiving "
|
||||
"of file descriptors");
|
||||
return ctx->io->receivefd (ctx, fd);
|
||||
}
|
234
tags/gpgme-1.1.5/assuan/assuan-client.c
Normal file
234
tags/gpgme-1.1.5/assuan/assuan-client.c
Normal file
@ -0,0 +1,234 @@
|
||||
/* assuan-client.c - client functions
|
||||
* Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
|
||||
*(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
|
||||
#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
|
||||
|
||||
|
||||
assuan_error_t
|
||||
_assuan_read_from_server (assuan_context_t ctx, int *okay, int *off)
|
||||
{
|
||||
char *line;
|
||||
int linelen;
|
||||
assuan_error_t rc;
|
||||
|
||||
*okay = 0;
|
||||
*off = 0;
|
||||
do
|
||||
{
|
||||
rc = _assuan_read_line (ctx);
|
||||
if (rc)
|
||||
return rc;
|
||||
line = ctx->inbound.line;
|
||||
linelen = ctx->inbound.linelen;
|
||||
}
|
||||
while (*line == '#' || !linelen);
|
||||
|
||||
if (linelen >= 1
|
||||
&& line[0] == 'D' && line[1] == ' ')
|
||||
{
|
||||
*okay = 2; /* data line */
|
||||
*off = 2;
|
||||
}
|
||||
else if (linelen >= 1
|
||||
&& line[0] == 'S'
|
||||
&& (line[1] == '\0' || line[1] == ' '))
|
||||
{
|
||||
*okay = 4;
|
||||
*off = 1;
|
||||
while (line[*off] == ' ')
|
||||
++*off;
|
||||
}
|
||||
else if (linelen >= 2
|
||||
&& line[0] == 'O' && line[1] == 'K'
|
||||
&& (line[2] == '\0' || line[2] == ' '))
|
||||
{
|
||||
*okay = 1;
|
||||
*off = 2;
|
||||
while (line[*off] == ' ')
|
||||
++*off;
|
||||
}
|
||||
else if (linelen >= 3
|
||||
&& line[0] == 'E' && line[1] == 'R' && line[2] == 'R'
|
||||
&& (line[3] == '\0' || line[3] == ' '))
|
||||
{
|
||||
*okay = 0;
|
||||
*off = 3;
|
||||
while (line[*off] == ' ')
|
||||
++*off;
|
||||
}
|
||||
else if (linelen >= 7
|
||||
&& line[0] == 'I' && line[1] == 'N' && line[2] == 'Q'
|
||||
&& line[3] == 'U' && line[4] == 'I' && line[5] == 'R'
|
||||
&& line[6] == 'E'
|
||||
&& (line[7] == '\0' || line[7] == ' '))
|
||||
{
|
||||
*okay = 3;
|
||||
*off = 7;
|
||||
while (line[*off] == ' ')
|
||||
++*off;
|
||||
}
|
||||
else if (linelen >= 3
|
||||
&& line[0] == 'E' && line[1] == 'N' && line[2] == 'D'
|
||||
&& (line[3] == '\0' || line[3] == ' '))
|
||||
{
|
||||
*okay = 5; /* end line */
|
||||
*off = 3;
|
||||
}
|
||||
else
|
||||
rc = _assuan_error (ASSUAN_Invalid_Response);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* assuan_transact:
|
||||
* @ctx: The Assuan context
|
||||
* @command: Command line to be send to the server
|
||||
* @data_cb: Callback function for data lines
|
||||
* @data_cb_arg: first argument passed to @data_cb
|
||||
* @inquire_cb: Callback function for a inquire response
|
||||
* @inquire_cb_arg: first argument passed to @inquire_cb
|
||||
* @status_cb: Callback function for a status response
|
||||
* @status_cb_arg: first argument passed to @status_cb
|
||||
*
|
||||
* FIXME: Write documentation
|
||||
*
|
||||
* Return value: 0 on success or error code. The error code may be
|
||||
* the one one returned by the server in error lines or from the
|
||||
* callback functions. Take care: When a callback returns an error
|
||||
* this function returns immediately with an error and thus the caller
|
||||
* will altter return an Assuan error (write erro in most cases).
|
||||
**/
|
||||
assuan_error_t
|
||||
assuan_transact (assuan_context_t ctx,
|
||||
const char *command,
|
||||
int (*data_cb)(void *, const void *, size_t),
|
||||
void *data_cb_arg,
|
||||
int (*inquire_cb)(void*, const char *),
|
||||
void *inquire_cb_arg,
|
||||
int (*status_cb)(void*, const char *),
|
||||
void *status_cb_arg)
|
||||
{
|
||||
assuan_error_t rc;
|
||||
int okay, off;
|
||||
char *line;
|
||||
int linelen;
|
||||
|
||||
rc = assuan_write_line (ctx, command);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (*command == '#' || !*command)
|
||||
return 0; /* Don't expect a response for a comment line. */
|
||||
|
||||
again:
|
||||
rc = _assuan_read_from_server (ctx, &okay, &off);
|
||||
if (rc)
|
||||
return rc; /* error reading from server */
|
||||
|
||||
line = ctx->inbound.line + off;
|
||||
linelen = ctx->inbound.linelen - off;
|
||||
|
||||
if (!okay)
|
||||
{
|
||||
rc = atoi (line);
|
||||
if (rc > 0 && rc < 100)
|
||||
rc = _assuan_error (ASSUAN_Server_Fault);
|
||||
else if (rc > 0 && rc <= 405)
|
||||
rc = _assuan_error (rc);
|
||||
}
|
||||
else if (okay == 2)
|
||||
{
|
||||
if (!data_cb)
|
||||
rc = _assuan_error (ASSUAN_No_Data_Callback);
|
||||
else
|
||||
{
|
||||
char *s, *d;
|
||||
|
||||
for (s=d=line; linelen; linelen--)
|
||||
{
|
||||
if (*s == '%' && linelen > 2)
|
||||
{ /* handle escaping */
|
||||
s++;
|
||||
*d++ = xtoi_2 (s);
|
||||
s += 2;
|
||||
linelen -= 2;
|
||||
}
|
||||
else
|
||||
*d++ = *s++;
|
||||
}
|
||||
*d = 0; /* add a hidden string terminator */
|
||||
rc = data_cb (data_cb_arg, line, d - line);
|
||||
if (!rc)
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
else if (okay == 3)
|
||||
{
|
||||
if (!inquire_cb)
|
||||
{
|
||||
assuan_write_line (ctx, "END"); /* get out of inquire mode */
|
||||
_assuan_read_from_server (ctx, &okay, &off); /* dummy read */
|
||||
rc = _assuan_error (ASSUAN_No_Inquire_Callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = inquire_cb (inquire_cb_arg, line);
|
||||
if (!rc)
|
||||
rc = assuan_send_data (ctx, NULL, 0); /* flush and send END */
|
||||
if (!rc)
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
else if (okay == 4)
|
||||
{
|
||||
if (status_cb)
|
||||
rc = status_cb (status_cb_arg, line);
|
||||
if (!rc)
|
||||
goto again;
|
||||
}
|
||||
else if (okay == 5)
|
||||
{
|
||||
if (!data_cb)
|
||||
rc = _assuan_error (ASSUAN_No_Data_Callback);
|
||||
else
|
||||
{
|
||||
rc = data_cb (data_cb_arg, NULL, 0);
|
||||
if (!rc)
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
85
tags/gpgme-1.1.5/assuan/assuan-connect.c
Normal file
85
tags/gpgme-1.1.5/assuan/assuan-connect.c
Normal file
@ -0,0 +1,85 @@
|
||||
/* assuan-connect.c - Establish a connection (client)
|
||||
* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
/* Disconnect and release the context CTX. */
|
||||
void
|
||||
assuan_disconnect (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
assuan_write_line (ctx, "BYE");
|
||||
ctx->finish_handler (ctx);
|
||||
ctx->deinit_handler (ctx);
|
||||
ctx->deinit_handler = NULL;
|
||||
_assuan_release_context (ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the PID of the peer or -1 if not known. This function works
|
||||
in some situations where assuan_get_ucred fails. */
|
||||
pid_t
|
||||
assuan_get_pid (assuan_context_t ctx)
|
||||
{
|
||||
return (ctx && ctx->pid)? ctx->pid : -1;
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
/* Return user credentials. PID, UID and GID amy be gived as NULL if
|
||||
you are not interested in this value. For getting the pid of the
|
||||
peer the assuan_get_pid is usually better suited. */
|
||||
assuan_error_t
|
||||
assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid)
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
if (!ctx->peercred.valid)
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
|
||||
#ifdef HAVE_SO_PEERCRED
|
||||
if (pid)
|
||||
*pid = ctx->peercred.pid;
|
||||
if (uid)
|
||||
*uid = ctx->peercred.uid;
|
||||
if (gid)
|
||||
*gid = ctx->peercred.gid;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_W32_SYSTEM */
|
332
tags/gpgme-1.1.5/assuan/assuan-defs.h
Normal file
332
tags/gpgme-1.1.5/assuan/assuan-defs.h
Normal file
@ -0,0 +1,332 @@
|
||||
/* assuan-defs.c - Internal definitions to Assuan
|
||||
* Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifndef ASSUAN_DEFS_H
|
||||
#define ASSUAN_DEFS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include "assuan.h"
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#define DIRSEP_C '/'
|
||||
#else
|
||||
#define DIRSEP_C '\\'
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
#define AF_LOCAL AF_UNIX
|
||||
/* We need to prefix the structure with a sockaddr_in header so we can
|
||||
use it later for sendto and recvfrom. */
|
||||
struct sockaddr_un
|
||||
{
|
||||
short sun_family;
|
||||
unsigned short sun_port;
|
||||
struct in_addr sun_addr;
|
||||
char sun_path[108-2-4]; /* Path name. */
|
||||
};
|
||||
|
||||
/* Not needed anymore because the current mingw32 defines this in
|
||||
sys/types.h */
|
||||
/* typedef int ssize_t; */
|
||||
|
||||
/* Missing W32 functions */
|
||||
int putc_unlocked (int c, FILE *stream);
|
||||
void * memrchr (const void *block, int c, size_t size);
|
||||
char * stpcpy (char *dest, const char *src);
|
||||
#endif
|
||||
|
||||
#define LINELENGTH ASSUAN_LINELENGTH
|
||||
|
||||
|
||||
struct cmdtbl_s
|
||||
{
|
||||
const char *name;
|
||||
int (*handler)(assuan_context_t, char *line);
|
||||
};
|
||||
|
||||
|
||||
/* A structure to dispatch I/O functions. All these functions need to
|
||||
return 0 on success and set ERRNO on failure. */
|
||||
struct assuan_io
|
||||
{
|
||||
/* Routine to read from input_fd. */
|
||||
ssize_t (*readfnc) (assuan_context_t, void *, size_t);
|
||||
/* Routine to write to output_fd. */
|
||||
ssize_t (*writefnc) (assuan_context_t, const void *, size_t);
|
||||
/* Send a file descriptor. */
|
||||
assuan_error_t (*sendfd) (assuan_context_t, int);
|
||||
/* Receive a file descriptor. */
|
||||
assuan_error_t (*receivefd) (assuan_context_t, int *);
|
||||
};
|
||||
|
||||
|
||||
/* The context we use with most functions. */
|
||||
struct assuan_context_s
|
||||
{
|
||||
assuan_error_t err_no;
|
||||
const char *err_str;
|
||||
int os_errno; /* Last system error number used with certain
|
||||
error codes. */
|
||||
|
||||
/* Context specific flags (cf. assuan_flag_t). */
|
||||
struct
|
||||
{
|
||||
unsigned int no_waitpid:1; /* See ASSUAN_NO_WAITPID. */
|
||||
} flags;
|
||||
|
||||
int confidential;
|
||||
int is_server; /* Set if this is context belongs to a server */
|
||||
int in_inquire;
|
||||
char *hello_line;
|
||||
char *okay_line; /* See assuan_set_okay_line() */
|
||||
|
||||
void *user_pointer; /* For assuan_get_pointer and assuan_set_pointer (). */
|
||||
|
||||
FILE *log_fp;
|
||||
|
||||
struct {
|
||||
int fd;
|
||||
int eof;
|
||||
char line[LINELENGTH];
|
||||
int linelen; /* w/o CR, LF - might not be the same as
|
||||
strlen(line) due to embedded nuls. However a nul
|
||||
is always written at this pos. */
|
||||
struct {
|
||||
char line[LINELENGTH];
|
||||
int linelen ;
|
||||
int pending; /* i.e. at least one line is available in the attic */
|
||||
} attic;
|
||||
} inbound;
|
||||
|
||||
struct {
|
||||
int fd;
|
||||
struct {
|
||||
FILE *fp;
|
||||
char line[LINELENGTH];
|
||||
int linelen;
|
||||
int error;
|
||||
} data;
|
||||
} outbound;
|
||||
|
||||
int pipe_mode; /* We are in pipe mode, i.e. we can handle just one
|
||||
connection and must terminate then. */
|
||||
pid_t pid; /* The pid of the peer. */
|
||||
int listen_fd; /* The fd we are listening on (used by socket servers) */
|
||||
int connected_fd; /* helper */
|
||||
|
||||
struct {
|
||||
int valid; /* Whether this structure has valid information. */
|
||||
#ifdef HAVE_SO_PEERCRED
|
||||
pid_t pid; /* The pid of the peer. */
|
||||
uid_t uid; /* The uid of the peer. */
|
||||
gid_t gid; /* The gid of the peer. */
|
||||
#endif /* HAVE_SO_PEERCRED */
|
||||
} peercred;
|
||||
|
||||
/* Used for Unix domain sockets. */
|
||||
struct sockaddr_un myaddr;
|
||||
struct sockaddr_un serveraddr;
|
||||
|
||||
/* Structure used for unix domain socket buffering. FIXME: We don't
|
||||
use datagrams anymore thus we could get away with a simpler
|
||||
buffering approach. */
|
||||
struct {
|
||||
void *buffer; /* Malloced buffer. */
|
||||
int bufferallocated; /* Memory allocated. */
|
||||
int bufferoffset; /* Offset of start of buffer. */
|
||||
int buffersize; /* Bytes buffered. */
|
||||
|
||||
int pendingfds[5]; /* Array to save received descriptors. */
|
||||
int pendingfdscount; /* Number of received descriptors. */
|
||||
} uds;
|
||||
|
||||
void (*deinit_handler)(assuan_context_t);
|
||||
int (*accept_handler)(assuan_context_t);
|
||||
int (*finish_handler)(assuan_context_t);
|
||||
|
||||
struct cmdtbl_s *cmdtbl;
|
||||
size_t cmdtbl_used; /* used entries */
|
||||
size_t cmdtbl_size; /* allocated size of table */
|
||||
|
||||
void (*bye_notify_fnc)(assuan_context_t);
|
||||
void (*reset_notify_fnc)(assuan_context_t);
|
||||
void (*cancel_notify_fnc)(assuan_context_t);
|
||||
int (*option_handler_fnc)(assuan_context_t,const char*, const char*);
|
||||
void (*input_notify_fnc)(assuan_context_t, const char *);
|
||||
void (*output_notify_fnc)(assuan_context_t, const char *);
|
||||
|
||||
/* This function is called right after a command has been processed.
|
||||
It may be used to command related cleanup. */
|
||||
void (*post_cmd_notify_fnc)(assuan_context_t, int);
|
||||
|
||||
/* If set, this is called right before logging an I/O line. With
|
||||
DIRECTION set to 1 it is called for an output oeration; 0 means
|
||||
an input operation. If bit 0 is set in the return value, the
|
||||
logging of the will be suppressed. With bit 1 set, the entire
|
||||
line will be ignored. */
|
||||
unsigned int (*io_monitor)(assuan_context_t ctx,
|
||||
int direction,
|
||||
const char *line,
|
||||
size_t linelen);
|
||||
|
||||
int input_fd; /* set by INPUT command */
|
||||
int output_fd; /* set by OUTPUT command */
|
||||
|
||||
/* io routines. */
|
||||
struct assuan_io *io;
|
||||
};
|
||||
|
||||
/*-- assuan-pipe-server.c --*/
|
||||
int _assuan_new_context (assuan_context_t *r_ctx);
|
||||
void _assuan_release_context (assuan_context_t ctx);
|
||||
|
||||
/*-- assuan-uds.c --*/
|
||||
void _assuan_uds_close_fds (assuan_context_t ctx);
|
||||
void _assuan_uds_deinit (assuan_context_t ctx);
|
||||
void _assuan_init_uds_io (assuan_context_t ctx);
|
||||
|
||||
|
||||
/*-- assuan-handler.c --*/
|
||||
int _assuan_register_std_commands (assuan_context_t ctx);
|
||||
|
||||
/*-- assuan-buffer.c --*/
|
||||
assuan_error_t _assuan_read_line (assuan_context_t ctx);
|
||||
int _assuan_cookie_write_data (void *cookie, const char *buffer, size_t size);
|
||||
int _assuan_cookie_write_flush (void *cookie);
|
||||
assuan_error_t _assuan_write_line (assuan_context_t ctx, const char *prefix,
|
||||
const char *line, size_t len);
|
||||
|
||||
/*-- assuan-client.c --*/
|
||||
assuan_error_t _assuan_read_from_server (assuan_context_t ctx,
|
||||
int *okay, int *off);
|
||||
|
||||
/*-- assuan-error.c --*/
|
||||
|
||||
|
||||
/* Map error codes as used in this implementaion to the libgpg-error
|
||||
codes. */
|
||||
assuan_error_t _assuan_error (int oldcode);
|
||||
|
||||
/* Extrac the erro code from A. This works for both the old and the
|
||||
new style error codes. This needs to be whenever an error code is
|
||||
compared. */
|
||||
#define err_code(a) ((a) & 0x00ffffff)
|
||||
|
||||
/* Check whether A is the erro code for EOF. We allow forold and new
|
||||
style EOF error codes here. */
|
||||
#define err_is_eof(a) ((a) == (-1) || err_code (a) == 16383)
|
||||
|
||||
|
||||
|
||||
/*-- assuan-util.c --*/
|
||||
void *_assuan_malloc (size_t n);
|
||||
void *_assuan_calloc (size_t n, size_t m);
|
||||
void *_assuan_realloc (void *p, size_t n);
|
||||
void _assuan_free (void *p);
|
||||
|
||||
#define xtrymalloc(a) _assuan_malloc ((a))
|
||||
#define xtrycalloc(a,b) _assuan_calloc ((a),(b))
|
||||
#define xtryrealloc(a,b) _assuan_realloc((a),(b))
|
||||
#define xfree(a) _assuan_free ((a))
|
||||
|
||||
#define set_error(c,e,t) \
|
||||
assuan_set_error ((c), _assuan_error (ASSUAN_ ## e), (t))
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
const char *_assuan_w32_strerror (int ec);
|
||||
#define w32_strerror(e) _assuan_w32_strerror ((e))
|
||||
int _assuan_gpg_strerror_r (unsigned int err, char *buf, size_t buflen);
|
||||
const char *_assuan_gpg_strsource (unsigned int err);
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
/*-- assuan-logging.c --*/
|
||||
void _assuan_set_default_log_stream (FILE *fp);
|
||||
|
||||
void _assuan_log_printf (const char *format, ...)
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
|
||||
__attribute__ ((format (printf,1,2)))
|
||||
#endif
|
||||
;
|
||||
void _assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length);
|
||||
void _assuan_log_sanitized_string (const char *string);
|
||||
|
||||
|
||||
/*-- assuan-io.c --*/
|
||||
pid_t _assuan_waitpid (pid_t pid, int *status, int options);
|
||||
|
||||
ssize_t _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size);
|
||||
ssize_t _assuan_simple_write (assuan_context_t ctx, const void *buffer,
|
||||
size_t size);
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
int _assuan_simple_sendmsg (assuan_context_t ctx, void *msg);
|
||||
int _assuan_simple_recvmsg (assuan_context_t ctx, void *msg);
|
||||
#else
|
||||
ssize_t _assuan_simple_sendmsg (assuan_context_t ctx, struct msghdr *msg);
|
||||
ssize_t _assuan_simple_recvmsg (assuan_context_t ctx, struct msghdr *msg);
|
||||
#endif
|
||||
|
||||
/*-- assuan-socket.c --*/
|
||||
int _assuan_close (int fd);
|
||||
int _assuan_sock_new (int domain, int type, int proto);
|
||||
int _assuan_sock_bind (int sockfd, struct sockaddr *addr, int addrlen);
|
||||
int _assuan_sock_connect (int sockfd, struct sockaddr *addr, int addrlen);
|
||||
|
||||
#ifdef HAVE_FOPENCOOKIE
|
||||
/* We have to implement funopen in terms of glibc's fopencookie. */
|
||||
FILE *_assuan_funopen(void *cookie,
|
||||
cookie_read_function_t *readfn,
|
||||
cookie_write_function_t *writefn,
|
||||
cookie_seek_function_t *seekfn,
|
||||
cookie_close_function_t *closefn);
|
||||
#define funopen(a,r,w,s,c) _assuan_funopen ((a), (r), (w), (s), (c))
|
||||
#endif /*HAVE_FOPENCOOKIE*/
|
||||
|
||||
/* Prototypes for replacement functions. */
|
||||
#ifndef HAVE_MEMRCHR
|
||||
void *memrchr (const void *block, int c, size_t size);
|
||||
#endif
|
||||
#ifndef HAVE_STPCPY
|
||||
char *stpcpy (char *dest, const char *src);
|
||||
#endif
|
||||
#ifndef HAVE_SETENV
|
||||
#define setenv _assuan_setenv
|
||||
#define unsetenv _assuan_unsetenv
|
||||
#define clearenv _assuan_clearenv
|
||||
int setenv (const char *name, const char *value, int replace);
|
||||
#endif
|
||||
#ifndef HAVE_PUTC_UNLOCKED
|
||||
int putc_unlocked (int c, FILE *stream);
|
||||
#endif
|
||||
|
||||
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
|
||||
#define DIMof(type,member) DIM(((type *)0)->member)
|
||||
|
||||
|
||||
#endif /*ASSUAN_DEFS_H*/
|
791
tags/gpgme-1.1.5/assuan/assuan-handler.c
Normal file
791
tags/gpgme-1.1.5/assuan/assuan-handler.c
Normal file
@ -0,0 +1,791 @@
|
||||
/* assuan-handler.c - dispatch commands
|
||||
* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
|
||||
|
||||
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
|
||||
#define digitp(a) ((a) >= '0' && (a) <= '9')
|
||||
|
||||
static int my_strcasecmp (const char *a, const char *b);
|
||||
|
||||
|
||||
|
||||
static int
|
||||
dummy_handler (assuan_context_t ctx, char *line)
|
||||
{
|
||||
return set_error (ctx, Server_Fault, "no handler registered");
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
std_handler_nop (assuan_context_t ctx, char *line)
|
||||
{
|
||||
return 0; /* okay */
|
||||
}
|
||||
|
||||
static int
|
||||
std_handler_cancel (assuan_context_t ctx, char *line)
|
||||
{
|
||||
if (ctx->cancel_notify_fnc)
|
||||
ctx->cancel_notify_fnc (ctx);
|
||||
return set_error (ctx, Not_Implemented, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
std_handler_option (assuan_context_t ctx, char *line)
|
||||
{
|
||||
char *key, *value, *p;
|
||||
|
||||
for (key=line; spacep (key); key++)
|
||||
;
|
||||
if (!*key)
|
||||
return set_error (ctx, Syntax_Error, "argument required");
|
||||
if (*key == '=')
|
||||
return set_error (ctx, Syntax_Error, "no option name given");
|
||||
for (value=key; *value && !spacep (value) && *value != '='; value++)
|
||||
;
|
||||
if (*value)
|
||||
{
|
||||
if (spacep (value))
|
||||
*value++ = 0; /* terminate key */
|
||||
for (; spacep (value); value++)
|
||||
;
|
||||
if (*value == '=')
|
||||
{
|
||||
*value++ = 0; /* terminate key */
|
||||
for (; spacep (value); value++)
|
||||
;
|
||||
if (!*value)
|
||||
return set_error (ctx, Syntax_Error, "option argument expected");
|
||||
}
|
||||
if (*value)
|
||||
{
|
||||
for (p = value + strlen(value) - 1; p > value && spacep (p); p--)
|
||||
;
|
||||
if (p > value)
|
||||
*++p = 0; /* strip trailing spaces */
|
||||
}
|
||||
}
|
||||
|
||||
if (*key == '-' && key[1] == '-' && key[2])
|
||||
key += 2; /* the double dashes are optional */
|
||||
if (*key == '-')
|
||||
return set_error (ctx, Syntax_Error,
|
||||
"option should not begin with one dash");
|
||||
|
||||
if (ctx->option_handler_fnc)
|
||||
return ctx->option_handler_fnc (ctx, key, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
std_handler_bye (assuan_context_t ctx, char *line)
|
||||
{
|
||||
if (ctx->bye_notify_fnc)
|
||||
ctx->bye_notify_fnc (ctx);
|
||||
assuan_close_input_fd (ctx);
|
||||
assuan_close_output_fd (ctx);
|
||||
return -1; /* pretty simple :-) */
|
||||
}
|
||||
|
||||
static int
|
||||
std_handler_auth (assuan_context_t ctx, char *line)
|
||||
{
|
||||
return set_error (ctx, Not_Implemented, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
std_handler_reset (assuan_context_t ctx, char *line)
|
||||
{
|
||||
if (ctx->reset_notify_fnc)
|
||||
ctx->reset_notify_fnc (ctx);
|
||||
assuan_close_input_fd (ctx);
|
||||
assuan_close_output_fd (ctx);
|
||||
_assuan_uds_close_fds (ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
std_handler_end (assuan_context_t ctx, char *line)
|
||||
{
|
||||
return set_error (ctx, Not_Implemented, NULL);
|
||||
}
|
||||
|
||||
assuan_error_t
|
||||
assuan_command_parse_fd (assuan_context_t ctx, char *line, int *rfd)
|
||||
{
|
||||
char *endp;
|
||||
|
||||
if ((strncmp (line, "FD", 2) && strncmp (line, "fd", 2))
|
||||
|| (line[2] != '=' && line[2] != '\0' && !spacep(&line[2])))
|
||||
return set_error (ctx, Syntax_Error, "FD[=<n>] expected");
|
||||
line += 2;
|
||||
if (*line == '=')
|
||||
{
|
||||
line ++;
|
||||
if (!digitp (*line))
|
||||
return set_error (ctx, Syntax_Error, "number required");
|
||||
*rfd = strtoul (line, &endp, 10);
|
||||
/* Remove that argument so that a notify handler won't see it. */
|
||||
memset (line, ' ', endp? (endp-line):strlen(line));
|
||||
|
||||
if (*rfd == ctx->inbound.fd)
|
||||
return set_error (ctx, Parameter_Conflict, "fd same as inbound fd");
|
||||
if (*rfd == ctx->outbound.fd)
|
||||
return set_error (ctx, Parameter_Conflict, "fd same as outbound fd");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
/* Our peer has sent the file descriptor. */
|
||||
return assuan_receivefd (ctx, rfd);
|
||||
}
|
||||
|
||||
/* Format is INPUT FD=<n> */
|
||||
static int
|
||||
std_handler_input (assuan_context_t ctx, char *line)
|
||||
{
|
||||
int rc, fd;
|
||||
|
||||
rc = assuan_command_parse_fd (ctx, line, &fd);
|
||||
if (rc)
|
||||
return rc;
|
||||
ctx->input_fd = fd;
|
||||
if (ctx->input_notify_fnc)
|
||||
ctx->input_notify_fnc (ctx, line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Format is OUTPUT FD=<n> */
|
||||
static int
|
||||
std_handler_output (assuan_context_t ctx, char *line)
|
||||
{
|
||||
int rc, fd;
|
||||
|
||||
rc = assuan_command_parse_fd (ctx, line, &fd);
|
||||
if (rc)
|
||||
return rc;
|
||||
ctx->output_fd = fd;
|
||||
if (ctx->output_notify_fnc)
|
||||
ctx->output_notify_fnc (ctx, line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* This is a table with the standard commands and handler for them.
|
||||
The table is used to initialize a new context and associate strings
|
||||
with default handlers */
|
||||
static struct {
|
||||
const char *name;
|
||||
int (*handler)(assuan_context_t, char *line);
|
||||
int always; /* always initialize this command */
|
||||
} std_cmd_table[] = {
|
||||
{ "NOP", std_handler_nop, 1 },
|
||||
{ "CANCEL", std_handler_cancel, 1 },
|
||||
{ "OPTION", std_handler_option, 1 },
|
||||
{ "BYE", std_handler_bye, 1 },
|
||||
{ "AUTH", std_handler_auth, 1 },
|
||||
{ "RESET", std_handler_reset, 1 },
|
||||
{ "END", std_handler_end, 1 },
|
||||
|
||||
{ "INPUT", std_handler_input },
|
||||
{ "OUTPUT", std_handler_output },
|
||||
{ "OPTION", std_handler_option, 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* assuan_register_command:
|
||||
* @ctx: the server context
|
||||
* @cmd_name: A string with the command name
|
||||
* @handler: The handler function to be called or NULL to use a default
|
||||
* handler.
|
||||
*
|
||||
* Register a handler to be used for a given command. Note that
|
||||
* several default handlers are already regsitered with a new context.
|
||||
* This function however allows to override them.
|
||||
*
|
||||
* Return value: 0 on success or an error code
|
||||
**/
|
||||
int
|
||||
assuan_register_command (assuan_context_t ctx,
|
||||
const char *cmd_name,
|
||||
int (*handler)(assuan_context_t, char *))
|
||||
{
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
if (cmd_name && !*cmd_name)
|
||||
cmd_name = NULL;
|
||||
|
||||
if (!cmd_name)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
if (!handler)
|
||||
{ /* find a default handler. */
|
||||
for (i=0; (s=std_cmd_table[i].name) && strcmp (cmd_name, s); i++)
|
||||
;
|
||||
if (!s)
|
||||
{ /* Try again but case insensitive. */
|
||||
for (i=0; (s=std_cmd_table[i].name)
|
||||
&& my_strcasecmp (cmd_name, s); i++)
|
||||
;
|
||||
}
|
||||
if (s)
|
||||
handler = std_cmd_table[i].handler;
|
||||
if (!handler)
|
||||
handler = dummy_handler; /* Last resort is the dummy handler. */
|
||||
}
|
||||
|
||||
if (!ctx->cmdtbl)
|
||||
{
|
||||
ctx->cmdtbl_size = 50;
|
||||
ctx->cmdtbl = xtrycalloc ( ctx->cmdtbl_size, sizeof *ctx->cmdtbl);
|
||||
if (!ctx->cmdtbl)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
ctx->cmdtbl_used = 0;
|
||||
}
|
||||
else if (ctx->cmdtbl_used >= ctx->cmdtbl_size)
|
||||
{
|
||||
struct cmdtbl_s *x;
|
||||
|
||||
x = xtryrealloc ( ctx->cmdtbl, (ctx->cmdtbl_size+10) * sizeof *x);
|
||||
if (!x)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
ctx->cmdtbl = x;
|
||||
ctx->cmdtbl_size += 50;
|
||||
}
|
||||
|
||||
ctx->cmdtbl[ctx->cmdtbl_used].name = cmd_name;
|
||||
ctx->cmdtbl[ctx->cmdtbl_used].handler = handler;
|
||||
ctx->cmdtbl_used++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_post_cmd_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t, int))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->post_cmd_notify_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_bye_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->bye_notify_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_reset_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->reset_notify_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_cancel_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->cancel_notify_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_option_handler (assuan_context_t ctx,
|
||||
int (*fnc)(assuan_context_t,
|
||||
const char*, const char*))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->option_handler_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_input_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t, const char *))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->input_notify_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
assuan_register_output_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t, const char *))
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
ctx->output_notify_fnc = fnc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Helper to register the standards commands */
|
||||
int
|
||||
_assuan_register_std_commands (assuan_context_t ctx)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
for (i=0; std_cmd_table[i].name; i++)
|
||||
{
|
||||
if (std_cmd_table[i].always)
|
||||
{
|
||||
rc = assuan_register_command (ctx, std_cmd_table[i].name, NULL);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Process the special data lines. The "D " has already been removed
|
||||
from the line. As all handlers this function may modify the line. */
|
||||
static int
|
||||
handle_data_line (assuan_context_t ctx, char *line, int linelen)
|
||||
{
|
||||
return set_error (ctx, Not_Implemented, NULL);
|
||||
}
|
||||
|
||||
/* like ascii_strcasecmp but assume that B is already uppercase */
|
||||
static int
|
||||
my_strcasecmp (const char *a, const char *b)
|
||||
{
|
||||
if (a == b)
|
||||
return 0;
|
||||
|
||||
for (; *a && *b; a++, b++)
|
||||
{
|
||||
if (((*a >= 'a' && *a <= 'z')? (*a&~0x20):*a) != *b)
|
||||
break;
|
||||
}
|
||||
return *a == *b? 0 : (((*a >= 'a' && *a <= 'z')? (*a&~0x20):*a) - *b);
|
||||
}
|
||||
|
||||
/* Parse the line, break out the command, find it in the command
|
||||
table, remove leading and white spaces from the arguments, call the
|
||||
handler with the argument line and return the error */
|
||||
static int
|
||||
dispatch_command (assuan_context_t ctx, char *line, int linelen)
|
||||
{
|
||||
char *p;
|
||||
const char *s;
|
||||
int shift, i;
|
||||
|
||||
if (*line == 'D' && line[1] == ' ') /* divert to special handler */
|
||||
return handle_data_line (ctx, line+2, linelen-2);
|
||||
|
||||
for (p=line; *p && *p != ' ' && *p != '\t'; p++)
|
||||
;
|
||||
if (p==line)
|
||||
return set_error (ctx, Syntax_Error, "leading white-space");
|
||||
if (*p)
|
||||
{ /* Skip over leading WS after the keyword */
|
||||
*p++ = 0;
|
||||
while ( *p == ' ' || *p == '\t')
|
||||
p++;
|
||||
}
|
||||
shift = p - line;
|
||||
|
||||
for (i=0; (s=ctx->cmdtbl[i].name); i++)
|
||||
{
|
||||
if (!strcmp (line, s))
|
||||
break;
|
||||
}
|
||||
if (!s)
|
||||
{ /* and try case insensitive */
|
||||
for (i=0; (s=ctx->cmdtbl[i].name); i++)
|
||||
{
|
||||
if (!my_strcasecmp (line, s))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!s)
|
||||
return set_error (ctx, Unknown_Command, NULL);
|
||||
line += shift;
|
||||
linelen -= shift;
|
||||
|
||||
/* fprintf (stderr, "DBG-assuan: processing %s `%s'\n", s, line); */
|
||||
return ctx->cmdtbl[i].handler (ctx, line);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
process_request (assuan_context_t ctx)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (ctx->in_inquire)
|
||||
return _assuan_error (ASSUAN_Nested_Commands);
|
||||
|
||||
rc = _assuan_read_line (ctx);
|
||||
if (rc)
|
||||
return rc;
|
||||
if (*ctx->inbound.line == '#' || !ctx->inbound.linelen)
|
||||
return 0; /* comment line - ignore */
|
||||
|
||||
ctx->outbound.data.error = 0;
|
||||
ctx->outbound.data.linelen = 0;
|
||||
/* dispatch command and return reply */
|
||||
rc = dispatch_command (ctx, ctx->inbound.line, ctx->inbound.linelen);
|
||||
/* check from data write errors */
|
||||
if (ctx->outbound.data.fp)
|
||||
{ /* Flush the data lines */
|
||||
fclose (ctx->outbound.data.fp);
|
||||
ctx->outbound.data.fp = NULL;
|
||||
if (!rc && ctx->outbound.data.error)
|
||||
rc = ctx->outbound.data.error;
|
||||
}
|
||||
else /* flush any data send w/o using the data fp */
|
||||
{
|
||||
assuan_send_data (ctx, NULL, 0);
|
||||
if (!rc && ctx->outbound.data.error)
|
||||
rc = ctx->outbound.data.error;
|
||||
}
|
||||
/* Error handling */
|
||||
if (!rc)
|
||||
{
|
||||
rc = assuan_write_line (ctx, ctx->okay_line? ctx->okay_line : "OK");
|
||||
}
|
||||
else if (err_is_eof (rc))
|
||||
{ /* No error checking because the peer may have already disconnect. */
|
||||
assuan_write_line (ctx, "OK closing connection");
|
||||
ctx->finish_handler (ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
char errline[300];
|
||||
|
||||
if (rc < 100)
|
||||
sprintf (errline, "ERR %d server fault (%.50s)",
|
||||
_assuan_error (ASSUAN_Server_Fault), assuan_strerror (rc));
|
||||
else
|
||||
{
|
||||
const char *text = ctx->err_no == rc? ctx->err_str:NULL;
|
||||
|
||||
#if defined(HAVE_W32_SYSTEM)
|
||||
unsigned int source, code;
|
||||
char ebuf[50];
|
||||
const char *esrc;
|
||||
|
||||
source = ((rc >> 24) & 0xff);
|
||||
code = (rc & 0x00ffffff);
|
||||
if (source
|
||||
&& !_assuan_gpg_strerror_r (rc, ebuf, sizeof ebuf)
|
||||
&& (esrc=_assuan_gpg_strsource (rc)))
|
||||
{
|
||||
/* Assume this is an libgpg-error. */
|
||||
sprintf (errline, "ERR %d %.50s <%.30s>%s%.100s",
|
||||
rc, ebuf, esrc,
|
||||
text? " - ":"", text?text:"");
|
||||
}
|
||||
else
|
||||
#elif defined(__GNUC__) && defined(__ELF__)
|
||||
/* If we have weak symbol support we try to use the error
|
||||
strings from libgpg-error without creating a dependency.
|
||||
They are used for debugging purposes only, so there is no
|
||||
problem if they are not available. We need to make sure
|
||||
that we are using ELF because only this guarantees that
|
||||
weak symbol support is available in case GNU ld is not
|
||||
used. It seems that old gcc versions don't implement the
|
||||
weak attribute properly but it works with the weak
|
||||
pragma. */
|
||||
|
||||
unsigned int source, code;
|
||||
|
||||
int gpg_strerror_r (unsigned int err, char *buf, size_t buflen)
|
||||
__attribute__ ((weak));
|
||||
const char *gpg_strsource (unsigned int err)
|
||||
__attribute__ ((weak));
|
||||
#if __GNUC__ < 3
|
||||
#pragma weak gpg_strerror_r
|
||||
#pragma weak gpg_strsource
|
||||
#endif
|
||||
|
||||
source = ((rc >> 24) & 0xff);
|
||||
code = (rc & 0x00ffffff);
|
||||
if (source && gpg_strsource && gpg_strerror_r)
|
||||
{
|
||||
/* Assume this is an libgpg-error. */
|
||||
char ebuf[50];
|
||||
|
||||
gpg_strerror_r (rc, ebuf, sizeof ebuf );
|
||||
sprintf (errline, "ERR %d %.50s <%.30s>%s%.100s",
|
||||
rc,
|
||||
ebuf,
|
||||
gpg_strsource (rc),
|
||||
text? " - ":"", text?text:"");
|
||||
}
|
||||
else
|
||||
#endif /* __GNUC__ && __ELF__ */
|
||||
sprintf (errline, "ERR %d %.50s%s%.100s",
|
||||
rc, assuan_strerror (rc), text? " - ":"", text?text:"");
|
||||
}
|
||||
rc = assuan_write_line (ctx, errline);
|
||||
}
|
||||
|
||||
if (ctx->post_cmd_notify_fnc)
|
||||
ctx->post_cmd_notify_fnc (ctx, rc);
|
||||
|
||||
ctx->confidential = 0;
|
||||
if (ctx->okay_line)
|
||||
{
|
||||
xfree (ctx->okay_line);
|
||||
ctx->okay_line = NULL;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* assuan_process:
|
||||
* @ctx: assuan context
|
||||
*
|
||||
* This function is used to handle the assuan protocol after a
|
||||
* connection has been established using assuan_accept(). This is the
|
||||
* main protocol handler.
|
||||
*
|
||||
* Return value: 0 on success or an error code if the assuan operation
|
||||
* failed. Note, that no error is returned for operational errors.
|
||||
**/
|
||||
int
|
||||
assuan_process (assuan_context_t ctx)
|
||||
{
|
||||
int rc;
|
||||
|
||||
do {
|
||||
rc = process_request (ctx);
|
||||
} while (!rc);
|
||||
|
||||
if (err_is_eof (rc))
|
||||
rc = 0;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assuan_process_next:
|
||||
* @ctx: Assuan context
|
||||
*
|
||||
* Same as assuan_process() but the user has to provide the outer
|
||||
* loop. He should loop as long as the return code is zero and stop
|
||||
* otherwise; -1 is regular end.
|
||||
*
|
||||
* See also: assuan_get_active_fds()
|
||||
* Return value: -1 for end of server, 0 on success or an error code
|
||||
**/
|
||||
int
|
||||
assuan_process_next (assuan_context_t ctx)
|
||||
{
|
||||
return process_request (ctx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assuan_get_active_fds:
|
||||
* @ctx: Assuan context
|
||||
* @what: 0 for read fds, 1 for write fds
|
||||
* @fdarray: Caller supplied array to store the FDs
|
||||
* @fdarraysize: size of that array
|
||||
*
|
||||
* Return all active filedescriptors for the given context. This
|
||||
* function can be used to select on the fds and call
|
||||
* assuan_process_next() if there is an active one. The first fd in
|
||||
* the array is the one used for the command connection.
|
||||
*
|
||||
* Note, that write FDs are not yet supported.
|
||||
*
|
||||
* Return value: number of FDs active and put into @fdarray or -1 on
|
||||
* error which is most likely a too small fdarray.
|
||||
**/
|
||||
int
|
||||
assuan_get_active_fds (assuan_context_t ctx, int what,
|
||||
int *fdarray, int fdarraysize)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
if (!ctx || fdarraysize < 2 || what < 0 || what > 1)
|
||||
return -1;
|
||||
|
||||
if (!what)
|
||||
{
|
||||
if (ctx->inbound.fd != -1)
|
||||
fdarray[n++] = ctx->inbound.fd;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ctx->outbound.fd != -1)
|
||||
fdarray[n++] = ctx->outbound.fd;
|
||||
if (ctx->outbound.data.fp)
|
||||
fdarray[n++] = fileno (ctx->outbound.data.fp);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/* Two simple wrappers to make the expected function types match. */
|
||||
#ifdef HAVE_FUNOPEN
|
||||
static int
|
||||
fun1_cookie_write (void *cookie, const char *buffer, int orig_size)
|
||||
{
|
||||
return _assuan_cookie_write_data (cookie, buffer, orig_size);
|
||||
}
|
||||
#endif /*HAVE_FUNOPEN*/
|
||||
#ifdef HAVE_FOPENCOOKIE
|
||||
static ssize_t
|
||||
fun2_cookie_write (void *cookie, const char *buffer, size_t orig_size)
|
||||
{
|
||||
return _assuan_cookie_write_data (cookie, buffer, orig_size);
|
||||
}
|
||||
#endif /*HAVE_FOPENCOOKIE*/
|
||||
|
||||
/* Return a FP to be used for data output. The FILE pointer is valid
|
||||
until the end of a handler. So a close is not needed. Assuan does
|
||||
all the buffering needed to insert the status line as well as the
|
||||
required line wappping and quoting for data lines.
|
||||
|
||||
We use GNU's custom streams here. There should be an alternative
|
||||
implementaion for systems w/o a glibc, a simple implementation
|
||||
could use a child process */
|
||||
FILE *
|
||||
assuan_get_data_fp (assuan_context_t ctx)
|
||||
{
|
||||
#if defined (HAVE_FOPENCOOKIE) || defined (HAVE_FUNOPEN)
|
||||
if (ctx->outbound.data.fp)
|
||||
return ctx->outbound.data.fp;
|
||||
|
||||
#ifdef HAVE_FUNOPEN
|
||||
ctx->outbound.data.fp = funopen (ctx, 0, fun1_cookie_write,
|
||||
0, _assuan_cookie_write_flush);
|
||||
#else
|
||||
ctx->outbound.data.fp = funopen (ctx, 0, fun2_cookie_write,
|
||||
0, _assuan_cookie_write_flush);
|
||||
#endif
|
||||
|
||||
ctx->outbound.data.error = 0;
|
||||
return ctx->outbound.data.fp;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Set the text used for the next OK reponse. This string is
|
||||
automatically reset to NULL after the next command. */
|
||||
assuan_error_t
|
||||
assuan_set_okay_line (assuan_context_t ctx, const char *line)
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
if (!line)
|
||||
{
|
||||
xfree (ctx->okay_line);
|
||||
ctx->okay_line = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: we need to use gcry_is_secure() to test whether
|
||||
we should allocate the entire line in secure memory */
|
||||
char *buf = xtrymalloc (3+strlen(line)+1);
|
||||
if (!buf)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
strcpy (buf, "OK ");
|
||||
strcpy (buf+3, line);
|
||||
xfree (ctx->okay_line);
|
||||
ctx->okay_line = buf;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
assuan_error_t
|
||||
assuan_write_status (assuan_context_t ctx,
|
||||
const char *keyword, const char *text)
|
||||
{
|
||||
char buffer[256];
|
||||
char *helpbuf;
|
||||
size_t n;
|
||||
assuan_error_t ae;
|
||||
|
||||
if ( !ctx || !keyword)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
if (!text)
|
||||
text = "";
|
||||
|
||||
n = 2 + strlen (keyword) + 1 + strlen (text) + 1;
|
||||
if (n < sizeof (buffer))
|
||||
{
|
||||
strcpy (buffer, "S ");
|
||||
strcat (buffer, keyword);
|
||||
if (*text)
|
||||
{
|
||||
strcat (buffer, " ");
|
||||
strcat (buffer, text);
|
||||
}
|
||||
ae = assuan_write_line (ctx, buffer);
|
||||
}
|
||||
else if ( (helpbuf = xtrymalloc (n)) )
|
||||
{
|
||||
strcpy (helpbuf, "S ");
|
||||
strcat (helpbuf, keyword);
|
||||
if (*text)
|
||||
{
|
||||
strcat (helpbuf, " ");
|
||||
strcat (helpbuf, text);
|
||||
}
|
||||
ae = assuan_write_line (ctx, helpbuf);
|
||||
xfree (helpbuf);
|
||||
}
|
||||
else
|
||||
ae = 0;
|
||||
return ae;
|
||||
}
|
241
tags/gpgme-1.1.5/assuan/assuan-inquire.c
Normal file
241
tags/gpgme-1.1.5/assuan/assuan-inquire.c
Normal file
@ -0,0 +1,241 @@
|
||||
/* assuan-inquire.c - handle inquire stuff
|
||||
* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
#define digitp(a) ((a) >= '0' && (a) <= '9')
|
||||
#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
|
||||
*(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
|
||||
#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
|
||||
|
||||
|
||||
struct membuf
|
||||
{
|
||||
size_t len;
|
||||
size_t size;
|
||||
char *buf;
|
||||
int out_of_core;
|
||||
int too_large;
|
||||
size_t maxlen;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* A simple implemnation of a dynamic buffer. Use init_membuf() to
|
||||
create a buffer, put_membuf to append bytes and get_membuf to
|
||||
release and return the buffer. Allocation errors are detected but
|
||||
only returned at the final get_membuf(), this helps not to clutter
|
||||
the code with out of core checks. */
|
||||
|
||||
static void
|
||||
init_membuf (struct membuf *mb, int initiallen, size_t maxlen)
|
||||
{
|
||||
mb->len = 0;
|
||||
mb->size = initiallen;
|
||||
mb->out_of_core = 0;
|
||||
mb->too_large = 0;
|
||||
mb->maxlen = maxlen;
|
||||
/* we need to allocate one byte more for get_membuf */
|
||||
mb->buf = xtrymalloc (initiallen+1);
|
||||
if (!mb->buf)
|
||||
mb->out_of_core = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
put_membuf (struct membuf *mb, const void *buf, size_t len)
|
||||
{
|
||||
if (mb->out_of_core || mb->too_large)
|
||||
return;
|
||||
|
||||
if (mb->maxlen && mb->len + len > mb->maxlen)
|
||||
{
|
||||
mb->too_large = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mb->len + len >= mb->size)
|
||||
{
|
||||
char *p;
|
||||
|
||||
mb->size += len + 1024;
|
||||
/* we need to allocate one byte more for get_membuf */
|
||||
p = xtryrealloc (mb->buf, mb->size+1);
|
||||
if (!p)
|
||||
{
|
||||
mb->out_of_core = 1;
|
||||
return;
|
||||
}
|
||||
mb->buf = p;
|
||||
}
|
||||
memcpy (mb->buf + mb->len, buf, len);
|
||||
mb->len += len;
|
||||
}
|
||||
|
||||
static void *
|
||||
get_membuf (struct membuf *mb, size_t *len)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (mb->out_of_core || mb->too_large)
|
||||
{
|
||||
xfree (mb->buf);
|
||||
mb->buf = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mb->buf[mb->len] = 0; /* there is enough space for the hidden eos */
|
||||
p = mb->buf;
|
||||
*len = mb->len;
|
||||
mb->buf = NULL;
|
||||
mb->out_of_core = 1; /* don't allow a reuse */
|
||||
return p;
|
||||
}
|
||||
|
||||
static void
|
||||
free_membuf (struct membuf *mb)
|
||||
{
|
||||
xfree (mb->buf);
|
||||
mb->buf = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assuan_inquire:
|
||||
* @ctx: An assuan context
|
||||
* @keyword: The keyword used for the inquire
|
||||
* @r_buffer: Returns an allocated buffer
|
||||
* @r_length: Returns the length of this buffer
|
||||
* @maxlen: If not 0, the size limit of the inquired data.
|
||||
*
|
||||
* A Server may use this to Send an inquire. r_buffer, r_length and
|
||||
* maxlen may all be NULL/0 to indicate that no real data is expected.
|
||||
*
|
||||
* Return value: 0 on success or an ASSUAN error code
|
||||
**/
|
||||
assuan_error_t
|
||||
assuan_inquire (assuan_context_t ctx, const char *keyword,
|
||||
unsigned char **r_buffer, size_t *r_length, size_t maxlen)
|
||||
{
|
||||
assuan_error_t rc;
|
||||
struct membuf mb;
|
||||
char cmdbuf[LINELENGTH-10]; /* (10 = strlen ("INQUIRE ")+CR,LF) */
|
||||
unsigned char *line, *p;
|
||||
int linelen;
|
||||
int nodataexpected;
|
||||
|
||||
if (!ctx || !keyword || (10 + strlen (keyword) >= sizeof (cmdbuf)))
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
nodataexpected = !r_buffer && !r_length && !maxlen;
|
||||
if (!nodataexpected && (!r_buffer || !r_length))
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
if (!ctx->is_server)
|
||||
return _assuan_error (ASSUAN_Not_A_Server);
|
||||
if (ctx->in_inquire)
|
||||
return _assuan_error (ASSUAN_Nested_Commands);
|
||||
|
||||
ctx->in_inquire = 1;
|
||||
if (nodataexpected)
|
||||
memset (&mb, 0, sizeof mb); /* avoid compiler warnings */
|
||||
else
|
||||
init_membuf (&mb, maxlen? maxlen:1024, maxlen);
|
||||
|
||||
strcpy (stpcpy (cmdbuf, "INQUIRE "), keyword);
|
||||
rc = assuan_write_line (ctx, cmdbuf);
|
||||
if (rc)
|
||||
goto leave;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
do
|
||||
{
|
||||
rc = _assuan_read_line (ctx);
|
||||
if (rc)
|
||||
goto leave;
|
||||
line = (unsigned char *) ctx->inbound.line;
|
||||
linelen = ctx->inbound.linelen;
|
||||
}
|
||||
while (*line == '#' || !linelen);
|
||||
if (line[0] == 'E' && line[1] == 'N' && line[2] == 'D'
|
||||
&& (!line[3] || line[3] == ' '))
|
||||
break; /* END command received*/
|
||||
if (line[0] == 'C' && line[1] == 'A' && line[2] == 'N')
|
||||
{
|
||||
rc = _assuan_error (ASSUAN_Canceled);
|
||||
goto leave;
|
||||
}
|
||||
if (line[0] != 'D' || line[1] != ' ' || nodataexpected)
|
||||
{
|
||||
rc = _assuan_error (ASSUAN_Unexpected_Command);
|
||||
goto leave;
|
||||
}
|
||||
if (linelen < 3)
|
||||
continue;
|
||||
line += 2;
|
||||
linelen -= 2;
|
||||
|
||||
p = line;
|
||||
while (linelen)
|
||||
{
|
||||
for (;linelen && *p != '%'; linelen--, p++)
|
||||
;
|
||||
put_membuf (&mb, line, p-line);
|
||||
if (linelen > 2)
|
||||
{ /* handle escaping */
|
||||
unsigned char tmp[1];
|
||||
p++;
|
||||
*tmp = xtoi_2 (p);
|
||||
p += 2;
|
||||
linelen -= 3;
|
||||
put_membuf (&mb, tmp, 1);
|
||||
}
|
||||
line = p;
|
||||
}
|
||||
if (mb.too_large)
|
||||
{
|
||||
rc = _assuan_error (ASSUAN_Too_Much_Data);
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nodataexpected)
|
||||
{
|
||||
*r_buffer = get_membuf (&mb, r_length);
|
||||
if (!*r_buffer)
|
||||
rc = _assuan_error (ASSUAN_Out_Of_Core);
|
||||
}
|
||||
|
||||
leave:
|
||||
if (!nodataexpected)
|
||||
free_membuf (&mb);
|
||||
ctx->in_inquire = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
145
tags/gpgme-1.1.5/assuan/assuan-io.c
Normal file
145
tags/gpgme-1.1.5/assuan/assuan-io.c
Normal file
@ -0,0 +1,145 @@
|
||||
/* assuan-io.c - Wraps the read and write functions.
|
||||
* Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
pid_t
|
||||
_assuan_waitpid (pid_t pid, int *status, int options)
|
||||
{
|
||||
return waitpid (pid, status, options);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ssize_t
|
||||
_assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* Due to the peculiarities of the W32 API we can't use read for a
|
||||
network socket and thus we try to use recv first and fallback to
|
||||
read if recv detects that it is not a network socket. */
|
||||
int n;
|
||||
|
||||
n = recv (ctx->inbound.fd, buffer, size, 0);
|
||||
if (n == -1 && WSAGetLastError () == WSAENOTSOCK)
|
||||
{
|
||||
DWORD nread = 0;
|
||||
|
||||
n = ReadFile ((HANDLE)ctx->inbound.fd, buffer, size, &nread, NULL);
|
||||
if (!n)
|
||||
{
|
||||
errno = EIO; /* FIXME: We should have a proper mapping. */
|
||||
n = -1;
|
||||
}
|
||||
else
|
||||
n = (int)nread;
|
||||
}
|
||||
return n;
|
||||
#else /*!HAVE_W32_SYSTEM*/
|
||||
return read (ctx->inbound.fd, buffer, size);
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
}
|
||||
|
||||
ssize_t
|
||||
_assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* Due to the peculiarities of the W32 API we can't use write for a
|
||||
network socket and thus we try to use send first and fallback to
|
||||
write if send detects that it is not a network socket. */
|
||||
int n;
|
||||
|
||||
n = send (ctx->outbound.fd, buffer, size, 0);
|
||||
if (n == -1 && WSAGetLastError () == WSAENOTSOCK)
|
||||
{
|
||||
DWORD nwrite;
|
||||
|
||||
n = WriteFile ((HANDLE)ctx->outbound.fd, buffer, size, &nwrite, NULL);
|
||||
if (!n)
|
||||
{
|
||||
errno = EIO; /* FIXME: We should have a proper mapping. */
|
||||
n = -1;
|
||||
}
|
||||
else
|
||||
n = (int)nwrite;
|
||||
}
|
||||
return n;
|
||||
#else /*!HAVE_W32_SYSTEM*/
|
||||
return write (ctx->outbound.fd, buffer, size);
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
int
|
||||
_assuan_simple_sendmsg (assuan_context_t ctx, void *msg)
|
||||
#else
|
||||
ssize_t
|
||||
_assuan_simple_sendmsg (assuan_context_t ctx, struct msghdr *msg)
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return _assuan_error (ASSUAN_Not_Implemented);
|
||||
#else
|
||||
int ret;
|
||||
while ( (ret = sendmsg (ctx->outbound.fd, msg, 0)) == -1 && errno == EINTR)
|
||||
;
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
int
|
||||
_assuan_simple_recvmsg (assuan_context_t ctx, void *msg)
|
||||
#else
|
||||
ssize_t
|
||||
_assuan_simple_recvmsg (assuan_context_t ctx, struct msghdr *msg)
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return _assuan_error (ASSUAN_Not_Implemented);
|
||||
#else
|
||||
int ret;
|
||||
while ( (ret = recvmsg (ctx->inbound.fd, msg, 0)) == -1 && errno == EINTR)
|
||||
;
|
||||
return ret;
|
||||
#endif
|
||||
}
|
157
tags/gpgme-1.1.5/assuan/assuan-listen.c
Normal file
157
tags/gpgme-1.1.5/assuan/assuan-listen.c
Normal file
@ -0,0 +1,157 @@
|
||||
/* assuan-listen.c - Wait for a connection (server)
|
||||
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
assuan_error_t
|
||||
assuan_set_hello_line (assuan_context_t ctx, const char *line)
|
||||
{
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
if (!line)
|
||||
{
|
||||
xfree (ctx->hello_line);
|
||||
ctx->hello_line = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *buf = xtrymalloc (3+strlen(line)+1);
|
||||
if (!buf)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
if (strchr (line, '\n'))
|
||||
strcpy (buf, line);
|
||||
else
|
||||
{
|
||||
strcpy (buf, "OK ");
|
||||
strcpy (buf+3, line);
|
||||
}
|
||||
xfree (ctx->hello_line);
|
||||
ctx->hello_line = buf;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assuan_accept:
|
||||
* @ctx: context
|
||||
*
|
||||
* Cancel any existing connection and wait for a connection from a
|
||||
* client. The initial handshake is performed which may include an
|
||||
* initial authentication or encryption negotiation.
|
||||
*
|
||||
* Return value: 0 on success or an error if the connection could for
|
||||
* some reason not be established.
|
||||
**/
|
||||
assuan_error_t
|
||||
assuan_accept (assuan_context_t ctx)
|
||||
{
|
||||
int rc;
|
||||
const char *p, *pend;
|
||||
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
if (ctx->pipe_mode > 1)
|
||||
return -1; /* second invocation for pipemode -> terminate */
|
||||
ctx->finish_handler (ctx);
|
||||
|
||||
rc = ctx->accept_handler (ctx);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
/* Send the hello. */
|
||||
p = ctx->hello_line;
|
||||
if (p && (pend = strchr (p, '\n')))
|
||||
{ /* This is a multi line hello. Send all but the last line as
|
||||
comments. */
|
||||
do
|
||||
{
|
||||
rc = _assuan_write_line (ctx, "# ", p, pend - p);
|
||||
if (rc)
|
||||
return rc;
|
||||
p = pend + 1;
|
||||
pend = strchr (p, '\n');
|
||||
}
|
||||
while (pend);
|
||||
rc = _assuan_write_line (ctx, "OK ", p, strlen (p));
|
||||
}
|
||||
else if (p)
|
||||
rc = assuan_write_line (ctx, p);
|
||||
else
|
||||
rc = assuan_write_line (ctx, "OK Pleased to meet you");
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (ctx->pipe_mode)
|
||||
ctx->pipe_mode = 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
assuan_get_input_fd (assuan_context_t ctx)
|
||||
{
|
||||
return ctx? ctx->input_fd : -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
assuan_get_output_fd (assuan_context_t ctx)
|
||||
{
|
||||
return ctx? ctx->output_fd : -1;
|
||||
}
|
||||
|
||||
|
||||
/* Close the fd descriptor set by the command INPUT FD=n. We handle
|
||||
this fd inside assuan so that we can do some initial checks */
|
||||
assuan_error_t
|
||||
assuan_close_input_fd (assuan_context_t ctx)
|
||||
{
|
||||
if (!ctx || ctx->input_fd == -1)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
_assuan_close (ctx->input_fd);
|
||||
ctx->input_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Close the fd descriptor set by the command OUTPUT FD=n. We handle
|
||||
this fd inside assuan so that we can do some initial checks */
|
||||
assuan_error_t
|
||||
assuan_close_output_fd (assuan_context_t ctx)
|
||||
{
|
||||
if (!ctx || ctx->output_fd == -1)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
_assuan_close (ctx->output_fd);
|
||||
ctx->output_fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
288
tags/gpgme-1.1.5/assuan/assuan-logging.c
Normal file
288
tags/gpgme-1.1.5/assuan/assuan-logging.c
Normal file
@ -0,0 +1,288 @@
|
||||
/* assuan-logging.c - Default logging function.
|
||||
* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
#include <windows.h>
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
static char prefix_buffer[80];
|
||||
static FILE *_assuan_log;
|
||||
static int full_logging;
|
||||
|
||||
void
|
||||
_assuan_set_default_log_stream (FILE *fp)
|
||||
{
|
||||
if (!_assuan_log)
|
||||
{
|
||||
_assuan_log = fp;
|
||||
full_logging = !!getenv ("ASSUAN_FULL_LOGGING");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
assuan_set_assuan_log_stream (FILE *fp)
|
||||
{
|
||||
_assuan_log = fp;
|
||||
}
|
||||
|
||||
|
||||
/* Set the per context log stream. Also enable the default log stream
|
||||
if it has not been set. */
|
||||
void
|
||||
assuan_set_log_stream (assuan_context_t ctx, FILE *fp)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
if (ctx->log_fp)
|
||||
fflush (ctx->log_fp);
|
||||
ctx->log_fp = fp;
|
||||
_assuan_set_default_log_stream (fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FILE *
|
||||
assuan_get_assuan_log_stream (void)
|
||||
{
|
||||
return _assuan_log ? _assuan_log : stderr;
|
||||
}
|
||||
|
||||
|
||||
/* Set the prefix to be used for logging to TEXT or
|
||||
resets it to the default if TEXT is NULL. */
|
||||
void
|
||||
assuan_set_assuan_log_prefix (const char *text)
|
||||
{
|
||||
if (text)
|
||||
{
|
||||
strncpy (prefix_buffer, text, sizeof (prefix_buffer)-1);
|
||||
prefix_buffer[sizeof (prefix_buffer)-1] = 0;
|
||||
}
|
||||
else
|
||||
*prefix_buffer = 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
assuan_get_assuan_log_prefix (void)
|
||||
{
|
||||
return prefix_buffer;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_assuan_log_printf (const char *format, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
FILE *fp;
|
||||
const char *prf;
|
||||
int save_errno = errno;
|
||||
|
||||
fp = assuan_get_assuan_log_stream ();
|
||||
prf = assuan_get_assuan_log_prefix ();
|
||||
if (*prf)
|
||||
fprintf (fp, "%s[%u]: ", prf, (unsigned int)getpid ());
|
||||
|
||||
va_start (arg_ptr, format);
|
||||
vfprintf (fp, format, arg_ptr );
|
||||
va_end (arg_ptr);
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
|
||||
/* Dump a possibly binary string (used for debugging). Distinguish
|
||||
ascii text from binary and print it accordingly. This function
|
||||
takes FILE pointer arg becuase logging may be enabled on a per
|
||||
context basis. */
|
||||
void
|
||||
_assuan_log_print_buffer (FILE *fp, const void *buffer, size_t length)
|
||||
{
|
||||
const unsigned char *s;
|
||||
int n;
|
||||
|
||||
for (n=length,s=buffer; n; n--, s++)
|
||||
if ((!isascii (*s) || iscntrl (*s) || !isprint (*s)) && !(*s >= 0x80))
|
||||
break;
|
||||
|
||||
s = buffer;
|
||||
if (!n && *s != '[')
|
||||
fwrite (buffer, length, 1, fp);
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_FLOCKFILE
|
||||
flockfile (fp);
|
||||
#endif
|
||||
putc_unlocked ('[', fp);
|
||||
if ( length > 16 && !full_logging)
|
||||
{
|
||||
for (n=0; n < 12; n++, s++)
|
||||
fprintf (fp, " %02x", *s);
|
||||
fprintf (fp, " ...(%d bytes skipped)", (int)length - 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (n=0; n < length; n++, s++)
|
||||
fprintf (fp, " %02x", *s);
|
||||
}
|
||||
putc_unlocked (' ', fp);
|
||||
putc_unlocked (']', fp);
|
||||
#ifdef HAVE_FUNLOCKFILE
|
||||
funlockfile (fp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Log a user supplied string. Escapes non-printable before
|
||||
printing. */
|
||||
void
|
||||
_assuan_log_sanitized_string (const char *string)
|
||||
{
|
||||
const unsigned char *s = (const unsigned char *) string;
|
||||
FILE *fp = assuan_get_assuan_log_stream ();
|
||||
|
||||
if (! *s)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_FLOCKFILE
|
||||
flockfile (fp);
|
||||
#endif
|
||||
|
||||
for (; *s; s++)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
switch (*s)
|
||||
{
|
||||
case '\r':
|
||||
c = 'r';
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
c = 'n';
|
||||
break;
|
||||
|
||||
case '\f':
|
||||
c = 'f';
|
||||
break;
|
||||
|
||||
case '\v':
|
||||
c = 'v';
|
||||
break;
|
||||
|
||||
case '\b':
|
||||
c = 'b';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((isascii (*s) && isprint (*s)) || (*s >= 0x80))
|
||||
putc_unlocked (*s, fp);
|
||||
else
|
||||
{
|
||||
putc_unlocked ('\\', fp);
|
||||
fprintf (fp, "x%02x", *s);
|
||||
}
|
||||
}
|
||||
|
||||
if (c)
|
||||
{
|
||||
putc_unlocked ('\\', fp);
|
||||
putc_unlocked (c, fp);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_FUNLOCKFILE
|
||||
funlockfile (fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
const char *
|
||||
_assuan_w32_strerror (int ec)
|
||||
{
|
||||
static char strerr[256];
|
||||
|
||||
if (ec == -1)
|
||||
ec = (int)GetLastError ();
|
||||
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec,
|
||||
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
strerr, sizeof (strerr)-1, NULL);
|
||||
return strerr;
|
||||
}
|
||||
|
||||
static int (*my_strerror_r) (unsigned int err, char *buf, size_t buflen);
|
||||
static const char * (*my_strsource) (unsigned int err);
|
||||
|
||||
static int
|
||||
load_libgpg_error (void)
|
||||
{
|
||||
/* This code is not race free but suitable for our purpose. */
|
||||
static volatile int initialized;
|
||||
void *handle;
|
||||
|
||||
if (initialized)
|
||||
return (my_strerror_r && my_strsource)? 0:-1;
|
||||
handle = LoadLibrary ("libgpg-error-0.dll");
|
||||
if (handle)
|
||||
{
|
||||
void *foo, *bar;
|
||||
foo = GetProcAddress (handle, "gpg_strerror_r");
|
||||
bar = GetProcAddress (handle, "gpg_strsource");
|
||||
if (foo && bar)
|
||||
{
|
||||
my_strerror_r = foo;
|
||||
my_strsource = bar;
|
||||
}
|
||||
else
|
||||
CloseHandle (handle);
|
||||
}
|
||||
initialized = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_assuan_gpg_strerror_r (unsigned int err, char *buf, size_t buflen)
|
||||
{
|
||||
if (load_libgpg_error ())
|
||||
return -1;
|
||||
return my_strerror_r (err, buf, buflen);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
_assuan_gpg_strsource (unsigned int err)
|
||||
{
|
||||
if (load_libgpg_error ())
|
||||
return NULL;
|
||||
return my_strsource (err);
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
889
tags/gpgme-1.1.5/assuan/assuan-pipe-connect.c
Normal file
889
tags/gpgme-1.1.5/assuan/assuan-pipe-connect.c
Normal file
@ -0,0 +1,889 @@
|
||||
/* assuan-pipe-connect.c - Establish a pipe connection (client)
|
||||
* Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#include <sys/wait.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
/* Hacks for Slowaris. */
|
||||
#ifndef PF_LOCAL
|
||||
# ifdef PF_UNIX
|
||||
# define PF_LOCAL PF_UNIX
|
||||
# else
|
||||
# define PF_LOCAL AF_UNIX
|
||||
# endif
|
||||
#endif
|
||||
#ifndef AF_LOCAL
|
||||
# define AF_LOCAL AF_UNIX
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _POSIX_OPEN_MAX
|
||||
#define MAX_OPEN_FDS _POSIX_OPEN_MAX
|
||||
#else
|
||||
#define MAX_OPEN_FDS 20
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* We assume that a HANDLE can be represented by an int which should
|
||||
be true for all i386 systems (HANDLE is defined as void *) and
|
||||
these are the only systems for which Windows is available. Further
|
||||
we assume that -1 denotes an invalid handle. */
|
||||
#define fd_to_handle(a) ((HANDLE)(a))
|
||||
#define handle_to_fd(a) ((int)(a))
|
||||
#define pid_to_handle(a) ((HANDLE)(a))
|
||||
#define handle_to_pid(a) ((int)(a))
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
/* This should be called to make sure that SIGPIPE gets ignored. */
|
||||
static void
|
||||
fix_signals (void)
|
||||
{
|
||||
#ifndef _ASSUAN_NO_FIXED_SIGNALS
|
||||
#ifndef HAVE_DOSISH_SYSTEM /* No SIGPIPE for these systems. */
|
||||
static int fixed_signals;
|
||||
|
||||
if (!fixed_signals)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
sigaction (SIGPIPE, NULL, &act);
|
||||
if (act.sa_handler == SIG_DFL)
|
||||
{
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
sigaction (SIGPIPE, &act, NULL);
|
||||
}
|
||||
fixed_signals = 1;
|
||||
/* FIXME: This is not MT safe */
|
||||
}
|
||||
#endif /*HAVE_DOSISH_SYSTEM*/
|
||||
#endif /*!_ASSUAN_NO_FIXED_SIGNALS*/
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
static int
|
||||
writen (int fd, const char *buffer, size_t length)
|
||||
{
|
||||
while (length)
|
||||
{
|
||||
int nwritten = write (fd, buffer, length);
|
||||
|
||||
if (nwritten < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
return -1; /* write error */
|
||||
}
|
||||
length -= nwritten;
|
||||
buffer += nwritten;
|
||||
}
|
||||
return 0; /* okay */
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
do_finish (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx->inbound.fd != -1)
|
||||
{
|
||||
_assuan_close (ctx->inbound.fd);
|
||||
if (ctx->inbound.fd == ctx->outbound.fd)
|
||||
ctx->outbound.fd = -1;
|
||||
ctx->inbound.fd = -1;
|
||||
}
|
||||
if (ctx->outbound.fd != -1)
|
||||
{
|
||||
_assuan_close (ctx->outbound.fd);
|
||||
ctx->outbound.fd = -1;
|
||||
}
|
||||
if (ctx->pid != -1 && ctx->pid)
|
||||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#ifndef _ASSUAN_USE_DOUBLE_FORK
|
||||
if (!ctx->flags.no_waitpid)
|
||||
_assuan_waitpid (ctx->pid, NULL, 0);
|
||||
ctx->pid = -1;
|
||||
#endif
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
do_deinit (assuan_context_t ctx)
|
||||
{
|
||||
do_finish (ctx);
|
||||
}
|
||||
|
||||
|
||||
/* Helper for pipe_connect. */
|
||||
static assuan_error_t
|
||||
initial_handshake (assuan_context_t *ctx)
|
||||
{
|
||||
int okay, off;
|
||||
assuan_error_t err;
|
||||
|
||||
err = _assuan_read_from_server (*ctx, &okay, &off);
|
||||
if (err)
|
||||
_assuan_log_printf ("can't connect server: %s\n",
|
||||
assuan_strerror (err));
|
||||
else if (okay != 1)
|
||||
{
|
||||
_assuan_log_printf ("can't connect server: `%s'\n",
|
||||
(*ctx)->inbound.line);
|
||||
err = _assuan_error (ASSUAN_Connect_Failed);
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
assuan_disconnect (*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#define pipe_connect pipe_connect_unix
|
||||
/* Unix version of the pipe connection code. We use an extra macro to
|
||||
make ChangeLog entries easier. */
|
||||
static assuan_error_t
|
||||
pipe_connect_unix (assuan_context_t *ctx,
|
||||
const char *name, const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void *opaque, int reserved),
|
||||
void *atforkvalue)
|
||||
{
|
||||
assuan_error_t err;
|
||||
int rp[2];
|
||||
int wp[2];
|
||||
char mypidstr[50];
|
||||
|
||||
if (!ctx || !name || !argv || !argv[0])
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
fix_signals ();
|
||||
|
||||
sprintf (mypidstr, "%lu", (unsigned long)getpid ());
|
||||
|
||||
if (pipe (rp) < 0)
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
|
||||
if (pipe (wp) < 0)
|
||||
{
|
||||
close (rp[0]);
|
||||
close (rp[1]);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
err = _assuan_new_context (ctx);
|
||||
if (err)
|
||||
{
|
||||
close (rp[0]);
|
||||
close (rp[1]);
|
||||
close (wp[0]);
|
||||
close (wp[1]);
|
||||
return err;
|
||||
}
|
||||
(*ctx)->pipe_mode = 1;
|
||||
(*ctx)->inbound.fd = rp[0]; /* Our inbound is read end of read pipe. */
|
||||
(*ctx)->outbound.fd = wp[1]; /* Our outbound is write end of write pipe. */
|
||||
(*ctx)->deinit_handler = do_deinit;
|
||||
(*ctx)->finish_handler = do_finish;
|
||||
|
||||
/* FIXME: For GPGME we should better use _gpgme_io_spawn. The PID
|
||||
stored here is actually soon useless. */
|
||||
(*ctx)->pid = fork ();
|
||||
if ((*ctx)->pid < 0)
|
||||
{
|
||||
close (rp[0]);
|
||||
close (rp[1]);
|
||||
close (wp[0]);
|
||||
close (wp[1]);
|
||||
_assuan_release_context (*ctx);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
if ((*ctx)->pid == 0)
|
||||
{
|
||||
#ifdef _ASSUAN_USE_DOUBLE_FORK
|
||||
pid_t pid;
|
||||
|
||||
if ((pid = fork ()) == 0)
|
||||
#endif
|
||||
{
|
||||
int i, n;
|
||||
char errbuf[512];
|
||||
int *fdp;
|
||||
|
||||
if (atfork)
|
||||
atfork (atforkvalue, 0);
|
||||
|
||||
/* Dup handles to stdin/stdout. */
|
||||
if (rp[1] != STDOUT_FILENO)
|
||||
{
|
||||
if (dup2 (rp[1], STDOUT_FILENO) == -1)
|
||||
{
|
||||
_assuan_log_printf ("dup2 failed in child: %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
}
|
||||
if (wp[0] != STDIN_FILENO)
|
||||
{
|
||||
if (dup2 (wp[0], STDIN_FILENO) == -1)
|
||||
{
|
||||
_assuan_log_printf ("dup2 failed in child: %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
}
|
||||
|
||||
/* Dup stderr to /dev/null unless it is in the list of FDs to be
|
||||
passed to the child. */
|
||||
fdp = fd_child_list;
|
||||
if (fdp)
|
||||
{
|
||||
for (; *fdp != -1 && *fdp != STDERR_FILENO; fdp++)
|
||||
;
|
||||
}
|
||||
if (!fdp || *fdp == -1)
|
||||
{
|
||||
int fd = open ("/dev/null", O_WRONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
_assuan_log_printf ("can't open `/dev/null': %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
if (dup2 (fd, STDERR_FILENO) == -1)
|
||||
{
|
||||
_assuan_log_printf ("dup2(dev/null, 2) failed: %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Close all files which will not be duped and are not in the
|
||||
fd_child_list. */
|
||||
n = sysconf (_SC_OPEN_MAX);
|
||||
if (n < 0)
|
||||
n = MAX_OPEN_FDS;
|
||||
for (i=0; i < n; i++)
|
||||
{
|
||||
if ( i == STDIN_FILENO || i == STDOUT_FILENO
|
||||
|| i == STDERR_FILENO)
|
||||
continue;
|
||||
fdp = fd_child_list;
|
||||
if (fdp)
|
||||
{
|
||||
while (*fdp != -1 && *fdp != i)
|
||||
fdp++;
|
||||
}
|
||||
|
||||
if (!(fdp && *fdp != -1))
|
||||
close(i);
|
||||
}
|
||||
errno = 0;
|
||||
|
||||
/* We store our parents pid in the environment so that the
|
||||
execed assuan server is able to read the actual pid of the
|
||||
client. The server can't use getppid because it might have
|
||||
been double forked before the assuan server has been
|
||||
initialized. */
|
||||
setenv ("_assuan_pipe_connect_pid", mypidstr, 1);
|
||||
|
||||
/* Make sure that we never pass a connection fd variable
|
||||
when using a simple pipe. */
|
||||
unsetenv ("_assuan_connection_fd");
|
||||
|
||||
execv (name, (char *const *) argv);
|
||||
/* oops - use the pipe to tell the parent about it */
|
||||
snprintf (errbuf, sizeof(errbuf)-1,
|
||||
"ERR %d can't exec `%s': %.50s\n",
|
||||
_assuan_error (ASSUAN_Problem_Starting_Server),
|
||||
name, strerror (errno));
|
||||
errbuf[sizeof(errbuf)-1] = 0;
|
||||
writen (1, errbuf, strlen (errbuf));
|
||||
_exit (4);
|
||||
}
|
||||
#ifdef _ASSUAN_USE_DOUBLE_FORK
|
||||
if (pid == -1)
|
||||
_exit (1);
|
||||
else
|
||||
_exit (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _ASSUAN_USE_DOUBLE_FORK
|
||||
_assuan_waitpid ((*ctx)->pid, NULL, 0);
|
||||
(*ctx)->pid = -1;
|
||||
#endif
|
||||
|
||||
close (rp[1]);
|
||||
close (wp[0]);
|
||||
|
||||
return initial_handshake (ctx);
|
||||
}
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
/* This function is similar to pipe_connect but uses a socketpair and
|
||||
sets the I/O up to use sendmsg/recvmsg. */
|
||||
static assuan_error_t
|
||||
socketpair_connect (assuan_context_t *ctx,
|
||||
const char *name, const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void *opaque, int reserved),
|
||||
void *atforkvalue)
|
||||
{
|
||||
assuan_error_t err;
|
||||
int fds[2];
|
||||
char mypidstr[50];
|
||||
|
||||
if (!ctx
|
||||
|| (name && (!argv || !argv[0]))
|
||||
|| (!name && argv))
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
fix_signals ();
|
||||
|
||||
sprintf (mypidstr, "%lu", (unsigned long)getpid ());
|
||||
|
||||
if ( socketpair (AF_LOCAL, SOCK_STREAM, 0, fds) )
|
||||
{
|
||||
_assuan_log_printf ("socketpair failed: %s\n", strerror (errno));
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
err = _assuan_new_context (ctx);
|
||||
if (err)
|
||||
{
|
||||
close (fds[0]);
|
||||
close (fds[1]);
|
||||
return err;
|
||||
}
|
||||
(*ctx)->pipe_mode = 1;
|
||||
(*ctx)->inbound.fd = fds[0];
|
||||
(*ctx)->outbound.fd = fds[0];
|
||||
_assuan_init_uds_io (*ctx);
|
||||
(*ctx)->deinit_handler = _assuan_uds_deinit;
|
||||
(*ctx)->finish_handler = do_finish;
|
||||
|
||||
(*ctx)->pid = fork ();
|
||||
if ((*ctx)->pid < 0)
|
||||
{
|
||||
close (fds[0]);
|
||||
close (fds[1]);
|
||||
_assuan_release_context (*ctx);
|
||||
*ctx = NULL;
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
if ((*ctx)->pid == 0)
|
||||
{
|
||||
#ifdef _ASSUAN_USE_DOUBLE_FORK
|
||||
pid_t pid;
|
||||
|
||||
if ((pid = fork ()) == 0)
|
||||
#endif
|
||||
{
|
||||
int fd, i, n;
|
||||
char errbuf[512];
|
||||
int *fdp;
|
||||
|
||||
if (atfork)
|
||||
atfork (atforkvalue, 0);
|
||||
|
||||
/* Connect stdin and stdout to /dev/null. */
|
||||
fd = open ("/dev/null", O_RDONLY);
|
||||
if (fd == -1 || dup2 (fd, STDIN_FILENO) == -1)
|
||||
{
|
||||
_assuan_log_printf ("dup2(dev/null) failed: %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
fd = open ("/dev/null", O_WRONLY);
|
||||
if (fd == -1 || dup2 (fd, STDOUT_FILENO) == -1)
|
||||
{
|
||||
_assuan_log_printf ("dup2(dev/null) failed: %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
|
||||
/* Dup stderr to /dev/null unless it is in the list of FDs to be
|
||||
passed to the child. */
|
||||
fdp = fd_child_list;
|
||||
if (fdp)
|
||||
{
|
||||
for (; *fdp != -1 && *fdp != STDERR_FILENO; fdp++)
|
||||
;
|
||||
}
|
||||
if (!fdp || *fdp == -1)
|
||||
{
|
||||
fd = open ("/dev/null", O_WRONLY);
|
||||
if (fd == -1 || dup2 (fd, STDERR_FILENO) == -1)
|
||||
{
|
||||
_assuan_log_printf ("dup2(dev/null) failed: %s\n",
|
||||
strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Close all files which will not be duped, are not in the
|
||||
fd_child_list and are not the connection fd. */
|
||||
n = sysconf (_SC_OPEN_MAX);
|
||||
if (n < 0)
|
||||
n = MAX_OPEN_FDS;
|
||||
for (i=0; i < n; i++)
|
||||
{
|
||||
if ( i == STDIN_FILENO || i == STDOUT_FILENO
|
||||
|| i == STDERR_FILENO || i == fds[1])
|
||||
continue;
|
||||
fdp = fd_child_list;
|
||||
if (fdp)
|
||||
{
|
||||
while (*fdp != -1 && *fdp != i)
|
||||
fdp++;
|
||||
}
|
||||
|
||||
if (!(fdp && *fdp != -1))
|
||||
close(i);
|
||||
}
|
||||
errno = 0;
|
||||
|
||||
/* We store our parents pid in the environment so that the
|
||||
execed assuan server is able to read the actual pid of the
|
||||
client. The server can't use getppid becuase it might have
|
||||
been double forked before the assuan server has been
|
||||
initialized. */
|
||||
setenv ("_assuan_pipe_connect_pid", mypidstr, 1);
|
||||
|
||||
/* Now set the environment variable used to convey the
|
||||
connection's file descriptor. */
|
||||
sprintf (mypidstr, "%d", fds[1]);
|
||||
if (setenv ("_assuan_connection_fd", mypidstr, 1))
|
||||
{
|
||||
_assuan_log_printf ("setenv failed: %s\n", strerror (errno));
|
||||
_exit (4);
|
||||
}
|
||||
|
||||
if (!name && !argv)
|
||||
{
|
||||
/* No name and no args given, thus we don't do an exec
|
||||
but continue the forked process. */
|
||||
_assuan_release_context (*ctx);
|
||||
*ctx = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
execv (name, (char *const *) argv);
|
||||
/* oops - use the pipe to tell the parent about it */
|
||||
snprintf (errbuf, sizeof(errbuf)-1,
|
||||
"ERR %d can't exec `%s': %.50s\n",
|
||||
_assuan_error (ASSUAN_Problem_Starting_Server),
|
||||
name, strerror (errno));
|
||||
errbuf[sizeof(errbuf)-1] = 0;
|
||||
writen (fds[1], errbuf, strlen (errbuf));
|
||||
_exit (4);
|
||||
}
|
||||
#ifdef _ASSUAN_USE_DOUBLE_FORK
|
||||
if (pid == -1)
|
||||
_exit (1);
|
||||
else
|
||||
_exit (0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef _ASSUAN_USE_DOUBLE_FORK
|
||||
_assuan_waitpid ((*ctx)->pid, NULL, 0);
|
||||
(*ctx)->pid = -1;
|
||||
#endif
|
||||
|
||||
close (fds[1]);
|
||||
|
||||
return initial_handshake (ctx);
|
||||
}
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* Build a command line for use with W32's CreateProcess. On success
|
||||
CMDLINE gets the address of a newly allocated string. */
|
||||
static int
|
||||
build_w32_commandline (const char * const *argv, char **cmdline)
|
||||
{
|
||||
int i, n;
|
||||
const char *s;
|
||||
char *buf, *p;
|
||||
|
||||
*cmdline = NULL;
|
||||
n = 0;
|
||||
for (i=0; (s=argv[i]); i++)
|
||||
{
|
||||
n += strlen (s) + 1 + 2; /* (1 space, 2 quoting */
|
||||
for (; *s; s++)
|
||||
if (*s == '\"')
|
||||
n++; /* Need to double inner quotes. */
|
||||
}
|
||||
n++;
|
||||
|
||||
buf = p = xtrymalloc (n);
|
||||
if (!buf)
|
||||
return -1;
|
||||
|
||||
for (i=0; argv[i]; i++)
|
||||
{
|
||||
if (i)
|
||||
p = stpcpy (p, " ");
|
||||
if (!*argv[i]) /* Empty string. */
|
||||
p = stpcpy (p, "\"\"");
|
||||
else if (strpbrk (argv[i], " \t\n\v\f\""))
|
||||
{
|
||||
p = stpcpy (p, "\"");
|
||||
for (s=argv[i]; *s; s++)
|
||||
{
|
||||
*p++ = *s;
|
||||
if (*s == '\"')
|
||||
*p++ = *s;
|
||||
}
|
||||
*p++ = '\"';
|
||||
*p = 0;
|
||||
}
|
||||
else
|
||||
p = stpcpy (p, argv[i]);
|
||||
}
|
||||
|
||||
*cmdline= buf;
|
||||
return 0;
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* Create pipe where one end end is inheritable. */
|
||||
static int
|
||||
create_inheritable_pipe (int filedes[2], int for_write)
|
||||
{
|
||||
HANDLE r, w, h;
|
||||
SECURITY_ATTRIBUTES sec_attr;
|
||||
|
||||
memset (&sec_attr, 0, sizeof sec_attr );
|
||||
sec_attr.nLength = sizeof sec_attr;
|
||||
sec_attr.bInheritHandle = FALSE;
|
||||
|
||||
if (!CreatePipe (&r, &w, &sec_attr, 0))
|
||||
{
|
||||
_assuan_log_printf ("CreatePipe failed: %s\n", w32_strerror (-1));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!DuplicateHandle (GetCurrentProcess(), for_write? r : w,
|
||||
GetCurrentProcess(), &h, 0,
|
||||
TRUE, DUPLICATE_SAME_ACCESS ))
|
||||
{
|
||||
_assuan_log_printf ("DuplicateHandle failed: %s\n", w32_strerror (-1));
|
||||
CloseHandle (r);
|
||||
CloseHandle (w);
|
||||
return -1;
|
||||
}
|
||||
if (for_write)
|
||||
{
|
||||
CloseHandle (r);
|
||||
r = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle (w);
|
||||
w = h;
|
||||
}
|
||||
|
||||
filedes[0] = handle_to_fd (r);
|
||||
filedes[1] = handle_to_fd (w);
|
||||
return 0;
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
#define pipe_connect pipe_connect_w32
|
||||
/* W32 version of the pipe connection code. */
|
||||
static assuan_error_t
|
||||
pipe_connect_w32 (assuan_context_t *ctx,
|
||||
const char *name, const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void *opaque, int reserved),
|
||||
void *atforkvalue)
|
||||
{
|
||||
assuan_error_t err;
|
||||
int rp[2];
|
||||
int wp[2];
|
||||
char mypidstr[50];
|
||||
char *cmdline;
|
||||
SECURITY_ATTRIBUTES sec_attr;
|
||||
PROCESS_INFORMATION pi =
|
||||
{
|
||||
NULL, /* Returns process handle. */
|
||||
0, /* Returns primary thread handle. */
|
||||
0, /* Returns pid. */
|
||||
0 /* Returns tid. */
|
||||
};
|
||||
STARTUPINFO si;
|
||||
int fd, *fdp;
|
||||
HANDLE nullfd = INVALID_HANDLE_VALUE;
|
||||
|
||||
if (!ctx || !name || !argv || !argv[0])
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
fix_signals ();
|
||||
|
||||
sprintf (mypidstr, "%lu", (unsigned long)getpid ());
|
||||
|
||||
/* Build the command line. */
|
||||
if (build_w32_commandline (argv, &cmdline))
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
|
||||
/* Create thew two pipes. */
|
||||
if (create_inheritable_pipe (rp, 0))
|
||||
{
|
||||
xfree (cmdline);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
if (create_inheritable_pipe (wp, 1))
|
||||
{
|
||||
CloseHandle (fd_to_handle (rp[0]));
|
||||
CloseHandle (fd_to_handle (rp[1]));
|
||||
xfree (cmdline);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
|
||||
err = _assuan_new_context (ctx);
|
||||
if (err)
|
||||
{
|
||||
CloseHandle (fd_to_handle (rp[0]));
|
||||
CloseHandle (fd_to_handle (rp[1]));
|
||||
CloseHandle (fd_to_handle (wp[0]));
|
||||
CloseHandle (fd_to_handle (wp[1]));
|
||||
xfree (cmdline);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
(*ctx)->pipe_mode = 1;
|
||||
(*ctx)->inbound.fd = rp[0]; /* Our inbound is read end of read pipe. */
|
||||
(*ctx)->outbound.fd = wp[1]; /* Our outbound is write end of write pipe. */
|
||||
(*ctx)->deinit_handler = do_deinit;
|
||||
(*ctx)->finish_handler = do_finish;
|
||||
|
||||
|
||||
/* fixme: Actually we should set the "_assuan_pipe_connect_pid" env
|
||||
variable. However this requires us to write a full environment
|
||||
handler, because the strings are expected in sorted order. The
|
||||
suggestion given in the MS Reference Library, to save the old
|
||||
value, changeit, create proces and restore it, is not thread
|
||||
safe. */
|
||||
|
||||
/* Start the process. */
|
||||
memset (&sec_attr, 0, sizeof sec_attr );
|
||||
sec_attr.nLength = sizeof sec_attr;
|
||||
sec_attr.bInheritHandle = FALSE;
|
||||
|
||||
memset (&si, 0, sizeof si);
|
||||
si.cb = sizeof (si);
|
||||
si.dwFlags = STARTF_USESTDHANDLES;
|
||||
si.hStdInput = fd_to_handle (wp[0]);
|
||||
si.hStdOutput = fd_to_handle (rp[1]);
|
||||
|
||||
/* Dup stderr to /dev/null unless it is in the list of FDs to be
|
||||
passed to the child. */
|
||||
fd = fileno (stderr);
|
||||
fdp = fd_child_list;
|
||||
if (fdp)
|
||||
{
|
||||
for (; *fdp != -1 && *fdp != fd; fdp++)
|
||||
;
|
||||
}
|
||||
if (!fdp || *fdp == -1)
|
||||
{
|
||||
nullfd = CreateFile ("nul", GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (nullfd == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
_assuan_log_printf ("can't open `nul': %s\n", w32_strerror (-1));
|
||||
CloseHandle (fd_to_handle (rp[0]));
|
||||
CloseHandle (fd_to_handle (rp[1]));
|
||||
CloseHandle (fd_to_handle (wp[0]));
|
||||
CloseHandle (fd_to_handle (wp[1]));
|
||||
xfree (cmdline);
|
||||
_assuan_release_context (*ctx);
|
||||
return -1;
|
||||
}
|
||||
si.hStdError = nullfd;
|
||||
}
|
||||
else
|
||||
si.hStdError = fd_to_handle (_get_osfhandle (fd));
|
||||
|
||||
|
||||
/* Note: We inherit all handles flagged as inheritable. This seems
|
||||
to be a security flaw but there seems to be no way of selecting
|
||||
handles to inherit. */
|
||||
/* _assuan_log_printf ("CreateProcess, path=`%s' cmdline=`%s'\n", */
|
||||
/* name, cmdline); */
|
||||
if (!CreateProcess (name, /* Program to start. */
|
||||
cmdline, /* Command line arguments. */
|
||||
&sec_attr, /* Process security attributes. */
|
||||
&sec_attr, /* Thread security attributes. */
|
||||
TRUE, /* Inherit handles. */
|
||||
(CREATE_DEFAULT_ERROR_MODE
|
||||
| GetPriorityClass (GetCurrentProcess ())
|
||||
| CREATE_SUSPENDED), /* Creation flags. */
|
||||
NULL, /* Environment. */
|
||||
NULL, /* Use current drive/directory. */
|
||||
&si, /* Startup information. */
|
||||
&pi /* Returns process information. */
|
||||
))
|
||||
{
|
||||
_assuan_log_printf ("CreateProcess failed: %s\n", w32_strerror (-1));
|
||||
CloseHandle (fd_to_handle (rp[0]));
|
||||
CloseHandle (fd_to_handle (rp[1]));
|
||||
CloseHandle (fd_to_handle (wp[0]));
|
||||
CloseHandle (fd_to_handle (wp[1]));
|
||||
if (nullfd != INVALID_HANDLE_VALUE)
|
||||
CloseHandle (nullfd);
|
||||
xfree (cmdline);
|
||||
_assuan_release_context (*ctx);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
xfree (cmdline);
|
||||
cmdline = NULL;
|
||||
if (nullfd != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle (nullfd);
|
||||
nullfd = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
CloseHandle (fd_to_handle (rp[1]));
|
||||
CloseHandle (fd_to_handle (wp[0]));
|
||||
|
||||
/* _assuan_log_printf ("CreateProcess ready: hProcess=%p hThread=%p" */
|
||||
/* " dwProcessID=%d dwThreadId=%d\n", */
|
||||
/* pi.hProcess, pi.hThread, */
|
||||
/* (int) pi.dwProcessId, (int) pi.dwThreadId); */
|
||||
|
||||
ResumeThread (pi.hThread);
|
||||
CloseHandle (pi.hThread);
|
||||
(*ctx)->pid = 0; /* We don't use the PID. */
|
||||
CloseHandle (pi.hProcess); /* We don't need to wait for the process. */
|
||||
|
||||
return initial_handshake (ctx);
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
/* Connect to a server over a pipe, creating the assuan context and
|
||||
returning it in CTX. The server filename is NAME, the argument
|
||||
vector in ARGV. FD_CHILD_LIST is a -1 terminated list of file
|
||||
descriptors not to close in the child. */
|
||||
assuan_error_t
|
||||
assuan_pipe_connect (assuan_context_t *ctx, const char *name,
|
||||
const char *const argv[], int *fd_child_list)
|
||||
{
|
||||
return pipe_connect (ctx, name, argv, fd_child_list, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
assuan_error_t
|
||||
assuan_pipe_connect2 (assuan_context_t *ctx,
|
||||
const char *name, const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void *opaque, int reserved),
|
||||
void *atforkvalue)
|
||||
{
|
||||
return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue);
|
||||
}
|
||||
|
||||
|
||||
/* Connect to a server over a full-duplex socket (i.e. created by
|
||||
socketpair), creating the assuan context and returning it in CTX.
|
||||
The server filename is NAME, the argument vector in ARGV.
|
||||
FD_CHILD_LIST is a -1 terminated list of file descriptors not to
|
||||
close in the child. ATFORK is called in the child right after the
|
||||
fork; ATFORKVALUE is passed as the first argument and 0 is passed
|
||||
as the second argument. The ATFORK function should only act if the
|
||||
second value is 0.
|
||||
|
||||
For now FLAGS may either take the value 0 to behave like
|
||||
assuan_pipe_connect2 or 1 to enable the described full-duplex
|
||||
socket behaviour.
|
||||
|
||||
If NAME as well as ARGV are NULL, no exec is done but the same
|
||||
process is continued. However all file descriptors are closed and
|
||||
some special environment variables are set. To let the caller
|
||||
detect whether the child or the parent continues, the child returns
|
||||
a CTX of NULL. */
|
||||
assuan_error_t
|
||||
assuan_pipe_connect_ext (assuan_context_t *ctx,
|
||||
const char *name, const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void *opaque, int reserved),
|
||||
void *atforkvalue, unsigned int flags)
|
||||
{
|
||||
if ((flags & 1))
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return _assuan_error (ASSUAN_Not_Implemented);
|
||||
#else
|
||||
return socketpair_connect (ctx, name, argv, fd_child_list,
|
||||
atfork, atforkvalue);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return pipe_connect (ctx, name, argv, fd_child_list, atfork, atforkvalue);
|
||||
}
|
||||
|
189
tags/gpgme-1.1.5/assuan/assuan-pipe-server.c
Normal file
189
tags/gpgme-1.1.5/assuan/assuan-pipe-server.c
Normal file
@ -0,0 +1,189 @@
|
||||
/* assuan-pipe-server.c - Assuan server working over a pipe
|
||||
* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
|
||||
static void
|
||||
deinit_pipe_server (assuan_context_t ctx)
|
||||
{
|
||||
/* nothing to do for this simple server */
|
||||
}
|
||||
|
||||
static int
|
||||
accept_connection (assuan_context_t ctx)
|
||||
{
|
||||
/* This is a NOP for a pipe server */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
finish_connection (assuan_context_t ctx)
|
||||
{
|
||||
/* This is a NOP for a pipe server */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create a new context. Note that the handlers are set up for a pipe
|
||||
server/client - this way we don't need extra dummy functions */
|
||||
int
|
||||
_assuan_new_context (assuan_context_t *r_ctx)
|
||||
{
|
||||
static struct assuan_io io = { _assuan_simple_read,
|
||||
_assuan_simple_write,
|
||||
0, 0 };
|
||||
|
||||
assuan_context_t ctx;
|
||||
int rc;
|
||||
|
||||
*r_ctx = NULL;
|
||||
ctx = xtrycalloc (1, sizeof *ctx);
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
ctx->input_fd = -1;
|
||||
ctx->output_fd = -1;
|
||||
|
||||
ctx->inbound.fd = -1;
|
||||
ctx->outbound.fd = -1;
|
||||
ctx->io = &io;
|
||||
|
||||
ctx->listen_fd = -1;
|
||||
/* Use the pipe server handler as a default. */
|
||||
ctx->deinit_handler = deinit_pipe_server;
|
||||
ctx->accept_handler = accept_connection;
|
||||
ctx->finish_handler = finish_connection;
|
||||
|
||||
rc = _assuan_register_std_commands (ctx);
|
||||
if (rc)
|
||||
xfree (ctx);
|
||||
else
|
||||
*r_ctx = ctx;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/* Returns true if atoi(S) denotes a valid socket. */
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
static int
|
||||
is_valid_socket (const char *s)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if ( fstat (atoi (s), &buf ) )
|
||||
return 0;
|
||||
return S_ISSOCK (buf.st_mode);
|
||||
}
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
int
|
||||
assuan_init_pipe_server (assuan_context_t *r_ctx, int filedes[2])
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = _assuan_new_context (r_ctx);
|
||||
if (!rc)
|
||||
{
|
||||
assuan_context_t ctx = *r_ctx;
|
||||
const char *s;
|
||||
unsigned long ul;
|
||||
|
||||
ctx->is_server = 1;
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* MS Windows has so many different types of handle that one
|
||||
needs to tranlsate them at many place forth and back. Also
|
||||
make sure that the fiel descriptos are in binary mode. */
|
||||
setmode (filedes[0], O_BINARY);
|
||||
setmode (filedes[1], O_BINARY);
|
||||
ctx->inbound.fd = _get_osfhandle (filedes[0]);
|
||||
ctx->outbound.fd = _get_osfhandle (filedes[1]);
|
||||
#else
|
||||
s = getenv ("_assuan_connection_fd");
|
||||
if (s && *s && is_valid_socket (s) )
|
||||
{
|
||||
/* Well, we are called with an bi-directional file
|
||||
descriptor. Prepare for using sendmsg/recvmsg. In this
|
||||
case we ignore the passed file descriptors. */
|
||||
ctx->inbound.fd = ctx->outbound.fd = atoi (s);
|
||||
_assuan_init_uds_io (ctx);
|
||||
ctx->deinit_handler = _assuan_uds_deinit;
|
||||
}
|
||||
else if (filedes && filedes[0] != -1 && filedes[1] != -1 )
|
||||
{
|
||||
/* Standard pipe server. */
|
||||
ctx->inbound.fd = filedes[0];
|
||||
ctx->outbound.fd = filedes[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
_assuan_release_context (*r_ctx);
|
||||
*r_ctx = NULL;
|
||||
return ASSUAN_Problem_Starting_Server;
|
||||
}
|
||||
#endif
|
||||
ctx->pipe_mode = 1;
|
||||
|
||||
s = getenv ("_assuan_pipe_connect_pid");
|
||||
if (s && (ul=strtoul (s, NULL, 10)) && ul)
|
||||
ctx->pid = (pid_t)ul;
|
||||
else
|
||||
ctx->pid = (pid_t)-1;
|
||||
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_assuan_release_context (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
xfree (ctx->hello_line);
|
||||
xfree (ctx->okay_line);
|
||||
xfree (ctx->cmdtbl);
|
||||
xfree (ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
assuan_deinit_server (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
/* We use this function pointer to avoid linking other server
|
||||
when not needed but still allow for a generic deinit function. */
|
||||
ctx->deinit_handler (ctx);
|
||||
ctx->deinit_handler = NULL;
|
||||
_assuan_release_context (ctx);
|
||||
}
|
||||
}
|
184
tags/gpgme-1.1.5/assuan/assuan-socket-connect.c
Normal file
184
tags/gpgme-1.1.5/assuan/assuan-socket-connect.c
Normal file
@ -0,0 +1,184 @@
|
||||
/* assuan-socket-connect.c - Assuan socket based client
|
||||
* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
/* Hacks for Slowaris. */
|
||||
#ifndef PF_LOCAL
|
||||
# ifdef PF_UNIX
|
||||
# define PF_LOCAL PF_UNIX
|
||||
# else
|
||||
# define PF_LOCAL AF_UNIX
|
||||
# endif
|
||||
#endif
|
||||
#ifndef AF_LOCAL
|
||||
# define AF_LOCAL AF_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef SUN_LEN
|
||||
# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
|
||||
+ strlen ((ptr)->sun_path))
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
do_finish (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx->inbound.fd != -1)
|
||||
{
|
||||
_assuan_close (ctx->inbound.fd);
|
||||
}
|
||||
ctx->inbound.fd = -1;
|
||||
ctx->outbound.fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
do_deinit (assuan_context_t ctx)
|
||||
{
|
||||
do_finish (ctx);
|
||||
}
|
||||
|
||||
|
||||
/* Make a connection to the Unix domain socket NAME and return a new
|
||||
Assuan context in CTX. SERVER_PID is currently not used but may
|
||||
become handy in the future. */
|
||||
assuan_error_t
|
||||
assuan_socket_connect (assuan_context_t *r_ctx,
|
||||
const char *name, pid_t server_pid)
|
||||
{
|
||||
return assuan_socket_connect_ext (r_ctx, name, server_pid, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Make a connection to the Unix domain socket NAME and return a new
|
||||
Assuan context in CTX. SERVER_PID is currently not used but may
|
||||
become handy in the future. With flags set to 1 sendmsg and
|
||||
recvmesg are used. */
|
||||
assuan_error_t
|
||||
assuan_socket_connect_ext (assuan_context_t *r_ctx,
|
||||
const char *name, pid_t server_pid,
|
||||
unsigned int flags)
|
||||
{
|
||||
static struct assuan_io io = { _assuan_simple_read,
|
||||
_assuan_simple_write };
|
||||
|
||||
assuan_error_t err;
|
||||
assuan_context_t ctx;
|
||||
int fd;
|
||||
struct sockaddr_un srvr_addr;
|
||||
size_t len;
|
||||
const char *s;
|
||||
|
||||
if (!r_ctx || !name)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
*r_ctx = NULL;
|
||||
|
||||
/* We require that the name starts with a slash, so that we
|
||||
eventually can reuse this function for other socket types. To
|
||||
make things easier we allow an optional dirver prefix. */
|
||||
s = name;
|
||||
if (*s && s[1] == ':')
|
||||
s += 2;
|
||||
if (*s != DIRSEP_C && *s != '/')
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
if (strlen (name)+1 >= sizeof srvr_addr.sun_path)
|
||||
return _assuan_error (ASSUAN_Invalid_Value);
|
||||
|
||||
err = _assuan_new_context (&ctx);
|
||||
if (err)
|
||||
return err;
|
||||
ctx->deinit_handler = ((flags&1))? _assuan_uds_deinit : do_deinit;
|
||||
ctx->finish_handler = do_finish;
|
||||
|
||||
fd = _assuan_sock_new (PF_LOCAL, SOCK_STREAM, 0);
|
||||
if (fd == -1)
|
||||
{
|
||||
_assuan_log_printf ("can't create socket: %s\n", strerror (errno));
|
||||
_assuan_release_context (ctx);
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
|
||||
memset (&srvr_addr, 0, sizeof srvr_addr);
|
||||
srvr_addr.sun_family = AF_LOCAL;
|
||||
strncpy (srvr_addr.sun_path, name, sizeof (srvr_addr.sun_path) - 1);
|
||||
srvr_addr.sun_path[sizeof (srvr_addr.sun_path) - 1] = 0;
|
||||
len = SUN_LEN (&srvr_addr);
|
||||
|
||||
|
||||
if (_assuan_sock_connect (fd, (struct sockaddr *) &srvr_addr, len) == -1)
|
||||
{
|
||||
_assuan_log_printf ("can't connect to `%s': %s\n",
|
||||
name, strerror (errno));
|
||||
_assuan_release_context (ctx);
|
||||
_assuan_close (fd);
|
||||
return _assuan_error (ASSUAN_Connect_Failed);
|
||||
}
|
||||
|
||||
ctx->inbound.fd = fd;
|
||||
ctx->outbound.fd = fd;
|
||||
ctx->io = &io;
|
||||
if ((flags&1))
|
||||
_assuan_init_uds_io (ctx);
|
||||
|
||||
/* initial handshake */
|
||||
{
|
||||
int okay, off;
|
||||
|
||||
err = _assuan_read_from_server (ctx, &okay, &off);
|
||||
if (err)
|
||||
_assuan_log_printf ("can't connect to server: %s\n",
|
||||
assuan_strerror (err));
|
||||
else if (okay != 1)
|
||||
{
|
||||
/*LOG ("can't connect to server: `");*/
|
||||
_assuan_log_sanitized_string (ctx->inbound.line);
|
||||
fprintf (assuan_get_assuan_log_stream (), "'\n");
|
||||
err = _assuan_error (ASSUAN_Connect_Failed);
|
||||
}
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
assuan_disconnect (ctx);
|
||||
}
|
||||
else
|
||||
*r_ctx = ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
193
tags/gpgme-1.1.5/assuan/assuan-socket-server.c
Normal file
193
tags/gpgme-1.1.5/assuan/assuan-socket-server.c
Normal file
@ -0,0 +1,193 @@
|
||||
/* assuan-socket-server.c - Assuan socket based server
|
||||
* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
# include <windows.h>
|
||||
# if HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
# elif HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
# endif
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# include <sys/un.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
static struct assuan_io io = { _assuan_simple_read,
|
||||
_assuan_simple_write };
|
||||
|
||||
|
||||
static int
|
||||
accept_connection_bottom (assuan_context_t ctx)
|
||||
{
|
||||
int fd = ctx->connected_fd;
|
||||
|
||||
ctx->peercred.valid = 0;
|
||||
#ifdef HAVE_SO_PEERCRED
|
||||
{
|
||||
struct ucred cr;
|
||||
socklen_t cl = sizeof cr;
|
||||
|
||||
if ( !getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
|
||||
{
|
||||
ctx->peercred.pid = cr.pid;
|
||||
ctx->peercred.uid = cr.uid;
|
||||
ctx->peercred.gid = cr.gid;
|
||||
ctx->peercred.valid = 1;
|
||||
|
||||
/* This overrides any already set PID if the function returns
|
||||
a valid one. */
|
||||
if (cr.pid != (pid_t)-1 && cr.pid)
|
||||
ctx->pid = cr.pid;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ctx->inbound.fd = fd;
|
||||
ctx->inbound.eof = 0;
|
||||
ctx->inbound.linelen = 0;
|
||||
ctx->inbound.attic.linelen = 0;
|
||||
ctx->inbound.attic.pending = 0;
|
||||
|
||||
ctx->outbound.fd = fd;
|
||||
ctx->outbound.data.linelen = 0;
|
||||
ctx->outbound.data.error = 0;
|
||||
|
||||
ctx->confidential = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
accept_connection (assuan_context_t ctx)
|
||||
{
|
||||
int fd;
|
||||
struct sockaddr_un clnt_addr;
|
||||
socklen_t len = sizeof clnt_addr;
|
||||
|
||||
fd = accept (ctx->listen_fd, (struct sockaddr*)&clnt_addr, &len );
|
||||
if (fd == -1)
|
||||
{
|
||||
ctx->os_errno = errno;
|
||||
return _assuan_error (ASSUAN_Accept_Failed);
|
||||
}
|
||||
|
||||
ctx->connected_fd = fd;
|
||||
return accept_connection_bottom (ctx);
|
||||
}
|
||||
|
||||
static int
|
||||
finish_connection (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx->inbound.fd != -1)
|
||||
{
|
||||
_assuan_close (ctx->inbound.fd);
|
||||
}
|
||||
ctx->inbound.fd = -1;
|
||||
ctx->outbound.fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
deinit_socket_server (assuan_context_t ctx)
|
||||
{
|
||||
finish_connection (ctx);
|
||||
}
|
||||
|
||||
/* Initialize a server for the socket LISTEN_FD which has already be
|
||||
put into listen mode */
|
||||
int
|
||||
assuan_init_socket_server (assuan_context_t *r_ctx, int listen_fd)
|
||||
{
|
||||
return assuan_init_socket_server_ext (r_ctx, listen_fd, 0);
|
||||
}
|
||||
|
||||
/* Initialize a server using the already accepted socket FD. This
|
||||
fucntion is deprecated. */
|
||||
int
|
||||
assuan_init_connected_socket_server (assuan_context_t *r_ctx, int fd)
|
||||
{
|
||||
return assuan_init_socket_server_ext (r_ctx, fd, 2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Flag bits: 0 - use sendmsg/recvmsg to allow descriptor passing
|
||||
1 - FD has already been accepted.
|
||||
*/
|
||||
int
|
||||
assuan_init_socket_server_ext (assuan_context_t *r_ctx, int fd,
|
||||
unsigned int flags)
|
||||
{
|
||||
assuan_context_t ctx;
|
||||
int rc;
|
||||
|
||||
*r_ctx = NULL;
|
||||
ctx = xtrycalloc (1, sizeof *ctx);
|
||||
if (!ctx)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
ctx->is_server = 1;
|
||||
if ((flags & 2))
|
||||
ctx->pipe_mode = 1; /* We want a second accept to indicate EOF. */
|
||||
ctx->input_fd = -1;
|
||||
ctx->output_fd = -1;
|
||||
|
||||
ctx->inbound.fd = -1;
|
||||
ctx->outbound.fd = -1;
|
||||
|
||||
if ((flags & 2))
|
||||
{
|
||||
ctx->listen_fd = -1;
|
||||
ctx->connected_fd = fd;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx->listen_fd = fd;
|
||||
ctx->connected_fd = -1;
|
||||
}
|
||||
ctx->deinit_handler = (flags & 1)? _assuan_uds_deinit:deinit_socket_server;
|
||||
ctx->accept_handler = ((flags & 2)
|
||||
? accept_connection_bottom
|
||||
: accept_connection);
|
||||
ctx->finish_handler = finish_connection;
|
||||
|
||||
ctx->io = &io;
|
||||
if ((flags & 1))
|
||||
_assuan_init_uds_io (ctx);
|
||||
|
||||
rc = _assuan_register_std_commands (ctx);
|
||||
if (rc)
|
||||
xfree (ctx);
|
||||
else
|
||||
*r_ctx = ctx;
|
||||
return rc;
|
||||
}
|
148
tags/gpgme-1.1.5/assuan/assuan-socket.c
Normal file
148
tags/gpgme-1.1.5/assuan/assuan-socket.c
Normal file
@ -0,0 +1,148 @@
|
||||
/* assuan-socket.c
|
||||
* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include "assuan-defs.h"
|
||||
|
||||
/* Hacks for Slowaris. */
|
||||
#ifndef PF_LOCAL
|
||||
# ifdef PF_UNIX
|
||||
# define PF_LOCAL PF_UNIX
|
||||
# else
|
||||
# define PF_LOCAL AF_UNIX
|
||||
# endif
|
||||
#endif
|
||||
#ifndef AF_LOCAL
|
||||
# define AF_LOCAL AF_UNIX
|
||||
#endif
|
||||
|
||||
int
|
||||
_assuan_close (int fd)
|
||||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
return close (fd);
|
||||
#else
|
||||
int rc = closesocket (fd);
|
||||
if (rc && WSAGetLastError () == WSAENOTSOCK)
|
||||
rc = close (fd);
|
||||
return rc;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_assuan_sock_new (int domain, int type, int proto)
|
||||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
return socket (domain, type, proto);
|
||||
#else
|
||||
if (domain == AF_UNIX || domain == AF_LOCAL)
|
||||
domain = AF_INET;
|
||||
return socket (domain, type, proto);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_assuan_sock_connect (int sockfd, struct sockaddr * addr, int addrlen)
|
||||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
return connect (sockfd, addr, addrlen);
|
||||
#else
|
||||
struct sockaddr_in myaddr;
|
||||
struct sockaddr_un * unaddr;
|
||||
FILE * fp;
|
||||
int port = 0;
|
||||
|
||||
unaddr = (struct sockaddr_un *)addr;
|
||||
fp = fopen (unaddr->sun_path, "rb");
|
||||
if (!fp)
|
||||
return -1;
|
||||
fscanf (fp, "%d", &port);
|
||||
fclose (fp);
|
||||
/* XXX: set errno in this case */
|
||||
if (port < 0 || port > 65535)
|
||||
return -1;
|
||||
|
||||
myaddr.sin_family = AF_INET;
|
||||
myaddr.sin_port = port;
|
||||
myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||
|
||||
/* we need this later. */
|
||||
unaddr->sun_family = myaddr.sin_family;
|
||||
unaddr->sun_port = myaddr.sin_port;
|
||||
unaddr->sun_addr.s_addr = myaddr.sin_addr.s_addr;
|
||||
|
||||
return connect (sockfd, (struct sockaddr *)&myaddr, sizeof myaddr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_assuan_sock_bind (int sockfd, struct sockaddr * addr, int addrlen)
|
||||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
return bind (sockfd, addr, addrlen);
|
||||
#else
|
||||
if (addr->sa_family == AF_LOCAL || addr->sa_family == AF_UNIX)
|
||||
{
|
||||
struct sockaddr_in myaddr;
|
||||
struct sockaddr_un * unaddr;
|
||||
FILE * fp;
|
||||
int len = sizeof myaddr;
|
||||
int rc;
|
||||
|
||||
myaddr.sin_port = 0;
|
||||
myaddr.sin_family = AF_INET;
|
||||
myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||
|
||||
rc = bind (sockfd, (struct sockaddr *)&myaddr, len);
|
||||
if (rc)
|
||||
return rc;
|
||||
rc = getsockname (sockfd, (struct sockaddr *)&myaddr, &len);
|
||||
if (rc)
|
||||
return rc;
|
||||
unaddr = (struct sockaddr_un *)addr;
|
||||
fp = fopen (unaddr->sun_path, "wb");
|
||||
if (!fp)
|
||||
return -1;
|
||||
fprintf (fp, "%d", myaddr.sin_port);
|
||||
fclose (fp);
|
||||
|
||||
/* we need this later. */
|
||||
unaddr->sun_family = myaddr.sin_family;
|
||||
unaddr->sun_port = myaddr.sin_port;
|
||||
unaddr->sun_addr.s_addr = myaddr.sin_addr.s_addr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
return bind (sockfd, addr, addrlen);
|
||||
#endif
|
||||
}
|
||||
|
313
tags/gpgme-1.1.5/assuan/assuan-uds.c
Normal file
313
tags/gpgme-1.1.5/assuan/assuan-uds.c
Normal file
@ -0,0 +1,313 @@
|
||||
/* assuan-uds.c - Assuan unix domain socket utilities
|
||||
* Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
/* Provide replacement for missing CMSG maccros. We assume that
|
||||
size_t matches the alignment requirement. */
|
||||
#define MY_ALIGN(n) ((((n))+ sizeof(size_t)-1) & (size_t)~(sizeof(size_t)-1))
|
||||
#ifndef CMSG_SPACE
|
||||
#define CMSG_SPACE(n) (MY_ALIGN(sizeof(struct cmsghdr)) + MY_ALIGN((n)))
|
||||
#endif
|
||||
#ifndef CMSG_LEN
|
||||
#define CMSG_LEN(n) (MY_ALIGN(sizeof(struct cmsghdr)) + (n))
|
||||
#endif
|
||||
#ifndef CMSG_FIRSTHDR
|
||||
#define CMSG_FIRSTHDR(mhdr) \
|
||||
((size_t)(mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
|
||||
? (struct cmsghdr*) (mhdr)->msg_control : (struct cmsghdr*)NULL)
|
||||
#endif
|
||||
#ifndef CMSG_DATA
|
||||
#define CMSG_DATA(cmsg) ((unsigned char*)((struct cmsghdr*)(cmsg)+1))
|
||||
#endif
|
||||
#endif /*USE_DESCRIPTOR_PASSING*/
|
||||
|
||||
|
||||
/* Read from a unix domain socket using sendmsg.
|
||||
|
||||
FIXME: We don't need the buffering. It is a leftover from the time
|
||||
when we used datagrams. */
|
||||
static ssize_t
|
||||
uds_reader (assuan_context_t ctx, void *buf, size_t buflen)
|
||||
{
|
||||
int len = ctx->uds.buffersize;
|
||||
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
if (!ctx->uds.bufferallocated)
|
||||
{
|
||||
ctx->uds.buffer = xtrymalloc (2048);
|
||||
if (!ctx->uds.buffer)
|
||||
return _assuan_error (ASSUAN_Out_Of_Core);
|
||||
ctx->uds.bufferallocated = 2048;
|
||||
}
|
||||
|
||||
while (!len) /* No data is buffered. */
|
||||
{
|
||||
struct msghdr msg;
|
||||
struct iovec iovec;
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
union {
|
||||
struct cmsghdr cm;
|
||||
char control[CMSG_SPACE(sizeof (int))];
|
||||
} control_u;
|
||||
struct cmsghdr *cmptr;
|
||||
#endif /*USE_DESCRIPTOR_PASSING*/
|
||||
|
||||
memset (&msg, 0, sizeof (msg));
|
||||
|
||||
msg.msg_name = NULL;
|
||||
msg.msg_namelen = 0;
|
||||
msg.msg_iov = &iovec;
|
||||
msg.msg_iovlen = 1;
|
||||
iovec.iov_base = ctx->uds.buffer;
|
||||
iovec.iov_len = ctx->uds.bufferallocated;
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
msg.msg_control = control_u.control;
|
||||
msg.msg_controllen = sizeof (control_u.control);
|
||||
#endif
|
||||
|
||||
len = _assuan_simple_recvmsg (ctx, &msg);
|
||||
if (len < 0)
|
||||
return -1;
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
ctx->uds.buffersize = len;
|
||||
ctx->uds.bufferoffset = 0;
|
||||
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
cmptr = CMSG_FIRSTHDR (&msg);
|
||||
if (cmptr && cmptr->cmsg_len == CMSG_LEN (sizeof(int)))
|
||||
{
|
||||
if (cmptr->cmsg_level != SOL_SOCKET
|
||||
|| cmptr->cmsg_type != SCM_RIGHTS)
|
||||
_assuan_log_printf ("unexpected ancillary data received\n");
|
||||
else
|
||||
{
|
||||
int fd = *((int*)CMSG_DATA (cmptr));
|
||||
|
||||
if (ctx->uds.pendingfdscount >= DIM (ctx->uds.pendingfds))
|
||||
{
|
||||
_assuan_log_printf ("too many descriptors pending - "
|
||||
"closing received descriptor %d\n", fd);
|
||||
_assuan_close (fd);
|
||||
}
|
||||
else
|
||||
ctx->uds.pendingfds[ctx->uds.pendingfdscount++] = fd;
|
||||
}
|
||||
}
|
||||
#endif /*USE_DESCRIPTOR_PASSING*/
|
||||
}
|
||||
|
||||
#else /*HAVE_W32_SYSTEM*/
|
||||
|
||||
len = recvfrom (ctx->inbound.fd, buf, buflen, 0, NULL, NULL);
|
||||
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
|
||||
/* Return some data to the user. */
|
||||
|
||||
if (len > buflen) /* We have more than the user requested. */
|
||||
len = buflen;
|
||||
|
||||
memcpy (buf, (char*)ctx->uds.buffer + ctx->uds.bufferoffset, len);
|
||||
ctx->uds.buffersize -= len;
|
||||
assert (ctx->uds.buffersize >= 0);
|
||||
ctx->uds.bufferoffset += len;
|
||||
assert (ctx->uds.bufferoffset <= ctx->uds.bufferallocated);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/* Write to the domain server. */
|
||||
static ssize_t
|
||||
uds_writer (assuan_context_t ctx, const void *buf, size_t buflen)
|
||||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
struct msghdr msg;
|
||||
struct iovec iovec;
|
||||
ssize_t len;
|
||||
|
||||
memset (&msg, 0, sizeof (msg));
|
||||
|
||||
msg.msg_name = NULL;
|
||||
msg.msg_namelen = 0;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_iov = &iovec;
|
||||
iovec.iov_base = (void*)buf;
|
||||
iovec.iov_len = buflen;
|
||||
|
||||
len = _assuan_simple_sendmsg (ctx, &msg);
|
||||
#else /*HAVE_W32_SYSTEM*/
|
||||
int len;
|
||||
|
||||
len = sendto (ctx->outbound.fd, buf, buflen, 0,
|
||||
(struct sockaddr *)&ctx->serveraddr,
|
||||
sizeof (struct sockaddr_in));
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
static assuan_error_t
|
||||
uds_sendfd (assuan_context_t ctx, int fd)
|
||||
{
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
struct msghdr msg;
|
||||
struct iovec iovec;
|
||||
union {
|
||||
struct cmsghdr cm;
|
||||
char control[CMSG_SPACE(sizeof (int))];
|
||||
} control_u;
|
||||
struct cmsghdr *cmptr;
|
||||
int len;
|
||||
char buffer[80];
|
||||
|
||||
/* We need to send some real data so that a read won't return 0
|
||||
which will be taken as an EOF. It also helps with debugging. */
|
||||
snprintf (buffer, sizeof(buffer)-1, "# descriptor %d is in flight\n", fd);
|
||||
buffer[sizeof(buffer)-1] = 0;
|
||||
|
||||
memset (&msg, 0, sizeof (msg));
|
||||
|
||||
msg.msg_name = NULL;
|
||||
msg.msg_namelen = 0;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_iov = &iovec;
|
||||
iovec.iov_base = buffer;
|
||||
iovec.iov_len = strlen (buffer);
|
||||
|
||||
msg.msg_control = control_u.control;
|
||||
msg.msg_controllen = sizeof (control_u.control);
|
||||
cmptr = CMSG_FIRSTHDR (&msg);
|
||||
cmptr->cmsg_len = CMSG_LEN(sizeof(int));
|
||||
cmptr->cmsg_level = SOL_SOCKET;
|
||||
cmptr->cmsg_type = SCM_RIGHTS;
|
||||
*((int*)CMSG_DATA (cmptr)) = fd;
|
||||
|
||||
len = _assuan_simple_sendmsg (ctx, &msg);
|
||||
if (len < 0)
|
||||
{
|
||||
_assuan_log_printf ("uds_sendfd: %s\n", strerror (errno));
|
||||
return _assuan_error (ASSUAN_Write_Error);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
#else
|
||||
return _assuan_error (ASSUAN_Not_Implemented);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static assuan_error_t
|
||||
uds_receivefd (assuan_context_t ctx, int *fd)
|
||||
{
|
||||
#ifdef USE_DESCRIPTOR_PASSING
|
||||
int i;
|
||||
|
||||
if (!ctx->uds.pendingfdscount)
|
||||
{
|
||||
_assuan_log_printf ("no pending file descriptors!\n");
|
||||
return _assuan_error (ASSUAN_General_Error);
|
||||
}
|
||||
assert (ctx->uds.pendingfdscount <= DIM(ctx->uds.pendingfds));
|
||||
|
||||
*fd = ctx->uds.pendingfds[0];
|
||||
for (i=1; i < ctx->uds.pendingfdscount; i++)
|
||||
ctx->uds.pendingfds[i-1] = ctx->uds.pendingfds[i];
|
||||
ctx->uds.pendingfdscount--;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return _assuan_error (ASSUAN_Not_Implemented);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Close all pending fds. */
|
||||
void
|
||||
_assuan_uds_close_fds (assuan_context_t ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ctx->uds.pendingfdscount; i++)
|
||||
_assuan_close (ctx->uds.pendingfds[i]);
|
||||
ctx->uds.pendingfdscount = 0;
|
||||
}
|
||||
|
||||
/* Deinitialize the unix domain socket I/O functions. */
|
||||
void
|
||||
_assuan_uds_deinit (assuan_context_t ctx)
|
||||
{
|
||||
/* First call the finish_handler which should close descriptors etc. */
|
||||
ctx->finish_handler (ctx);
|
||||
|
||||
if (ctx->uds.buffer)
|
||||
{
|
||||
assert (ctx->uds.bufferallocated);
|
||||
ctx->uds.bufferallocated = 0;
|
||||
xfree (ctx->uds.buffer);
|
||||
}
|
||||
|
||||
_assuan_uds_close_fds (ctx);
|
||||
}
|
||||
|
||||
|
||||
/* Helper function to initialize a context for domain I/O. */
|
||||
void
|
||||
_assuan_init_uds_io (assuan_context_t ctx)
|
||||
{
|
||||
static struct assuan_io io = { uds_reader, uds_writer,
|
||||
uds_sendfd, uds_receivefd };
|
||||
|
||||
ctx->io = &io;
|
||||
ctx->uds.buffer = 0;
|
||||
ctx->uds.bufferoffset = 0;
|
||||
ctx->uds.buffersize = 0;
|
||||
ctx->uds.bufferallocated = 0;
|
||||
ctx->uds.pendingfdscount = 0;
|
||||
}
|
||||
|
171
tags/gpgme-1.1.5/assuan/assuan-util.c
Normal file
171
tags/gpgme-1.1.5/assuan/assuan-util.c
Normal file
@ -0,0 +1,171 @@
|
||||
/* assuan-util.c - Utility functions for Assuan
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "assuan-defs.h"
|
||||
|
||||
static void *(*alloc_func)(size_t n) = malloc;
|
||||
static void *(*realloc_func)(void *p, size_t n) = realloc;
|
||||
static void (*free_func)(void*) = free;
|
||||
|
||||
void
|
||||
assuan_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
|
||||
void *(*new_realloc_func)(void *p, size_t n),
|
||||
void (*new_free_func)(void*) )
|
||||
{
|
||||
alloc_func = new_alloc_func;
|
||||
realloc_func = new_realloc_func;
|
||||
free_func = new_free_func;
|
||||
}
|
||||
|
||||
void *
|
||||
_assuan_malloc (size_t n)
|
||||
{
|
||||
return alloc_func (n);
|
||||
}
|
||||
|
||||
void *
|
||||
_assuan_realloc (void *a, size_t n)
|
||||
{
|
||||
return realloc_func (a, n);
|
||||
}
|
||||
|
||||
void *
|
||||
_assuan_calloc (size_t n, size_t m)
|
||||
{
|
||||
void *p;
|
||||
size_t nbytes;
|
||||
|
||||
nbytes = n * m;
|
||||
if (m && nbytes / m != n)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = _assuan_malloc (nbytes);
|
||||
if (p)
|
||||
memset (p, 0, nbytes);
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
_assuan_free (void *p)
|
||||
{
|
||||
if (p)
|
||||
free_func (p);
|
||||
}
|
||||
|
||||
|
||||
/* Store the error in the context so that the error sending function
|
||||
can take out a descriptive text. Inside the assuan code, use the
|
||||
macro set_error instead of this function. */
|
||||
int
|
||||
assuan_set_error (assuan_context_t ctx, int err, const char *text)
|
||||
{
|
||||
ctx->err_no = err;
|
||||
ctx->err_str = text;
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
assuan_set_pointer (assuan_context_t ctx, void *pointer)
|
||||
{
|
||||
if (ctx)
|
||||
ctx->user_pointer = pointer;
|
||||
}
|
||||
|
||||
void *
|
||||
assuan_get_pointer (assuan_context_t ctx)
|
||||
{
|
||||
return ctx? ctx->user_pointer : NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
assuan_begin_confidential (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
ctx->confidential = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
assuan_end_confidential (assuan_context_t ctx)
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
ctx->confidential = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
assuan_set_io_monitor (assuan_context_t ctx,
|
||||
unsigned int (*monitor)(assuan_context_t ctx,
|
||||
int direction,
|
||||
const char *line,
|
||||
size_t linelen))
|
||||
{
|
||||
if (ctx)
|
||||
{
|
||||
ctx->io_monitor = monitor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* For context CTX, set the flag FLAG to VALUE. Values for flags
|
||||
are usually 1 or 0 but certain flags might allow for other values;
|
||||
see the description of the type assuan_flag_t for details. */
|
||||
void
|
||||
assuan_set_flag (assuan_context_t ctx, assuan_flag_t flag, int value)
|
||||
{
|
||||
if (!ctx)
|
||||
return;
|
||||
switch (flag)
|
||||
{
|
||||
case ASSUAN_NO_WAITPID: ctx->flags.no_waitpid = value; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the VALUE of FLAG in context CTX. */
|
||||
int
|
||||
assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag)
|
||||
{
|
||||
if (!ctx)
|
||||
return 0;
|
||||
switch (flag)
|
||||
{
|
||||
case ASSUAN_NO_WAITPID: return ctx->flags.no_waitpid;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
557
tags/gpgme-1.1.5/assuan/assuan.h
Normal file
557
tags/gpgme-1.1.5/assuan/assuan.h
Normal file
@ -0,0 +1,557 @@
|
||||
/* assuan.c - Definitions for the Assuan IPC library
|
||||
* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of Assuan.
|
||||
*
|
||||
* Assuan is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Assuan is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifndef ASSUAN_H
|
||||
#define ASSUAN_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/* To use this file with libraries the following macros are useful:
|
||||
|
||||
#define _ASSUAN_EXT_SYM_PREFIX _foo_
|
||||
|
||||
This prefixes all external symbols with "_foo_".
|
||||
|
||||
#define _ASSUAN_ONLY_GPG_ERRORS
|
||||
|
||||
If this is defined all old-style Assuan error codes are made
|
||||
inactive as well as other dereacted stuff.
|
||||
|
||||
The follwing macros are used internally in the implementation of
|
||||
libassuan:
|
||||
|
||||
#define _ASSUAN_NO_PTH
|
||||
|
||||
This avoids inclusion of special GNU Pth hacks.
|
||||
|
||||
#define _ASSUAN_NO_FIXED_SIGNALS
|
||||
|
||||
This disables changing of certain signal handler; i.e. SIGPIPE.
|
||||
|
||||
#define _ASSUAN_USE_DOUBLE_FORK
|
||||
|
||||
Use a double fork approach when connecting to a server through
|
||||
a pipe.
|
||||
*/
|
||||
/**** Begin GPGME specific modifications. ******/
|
||||
#define _ASSUAN_EXT_SYM_PREFIX _gpgme_
|
||||
#define _ASSUAN_NO_PTH
|
||||
#define _ASSUAN_NO_FIXED_SIGNALS
|
||||
#define _ASSUAN_USE_DOUBLE_FORK
|
||||
|
||||
#ifdef _ASSUAN_IN_GPGME_BUILD_ASSUAN
|
||||
#include <ath.h>
|
||||
|
||||
int _gpgme_io_read (int fd, void *buffer, size_t count);
|
||||
int _gpgme_io_write (int fd, const void *buffer, size_t count);
|
||||
int _gpgme_io_sendmsg (int sock, const struct msghdr *msg, int flags);
|
||||
int _gpgme_io_recvmsg (int sock, struct msghdr *msg, int flags);
|
||||
|
||||
#define read _gpgme_io_read
|
||||
#define write _gpgme_io_write
|
||||
#define waitpid _gpgme_ath_waitpid
|
||||
#define select _gpgme_ath_select
|
||||
#define accept _gpgme_ath_accept
|
||||
#define connect _gpgme_ath_connect
|
||||
#define sendmsg _gpgme_io_sendmsg
|
||||
#define recvmsg _gpgme_io_recvmsg
|
||||
#endif /*_ASSUAN_IN_GPGME_BUILD_ASSUAN*/
|
||||
/**** End GPGME specific modifications. ******/
|
||||
|
||||
|
||||
#ifdef _ASSUAN_EXT_SYM_PREFIX
|
||||
#define _ASSUAN_PREFIX1(x,y) x ## y
|
||||
#define _ASSUAN_PREFIX2(x,y) _ASSUAN_PREFIX1(x,y)
|
||||
#define _ASSUAN_PREFIX(x) _ASSUAN_PREFIX2(_ASSUAN_EXT_SYM_PREFIX,x)
|
||||
#define assuan_ _ASSUAN_PREFIX(assuan_)
|
||||
#define assuan_register_command _ASSUAN_PREFIX(assuan_register_command)
|
||||
#define assuan_register_post_cmd_notify \
|
||||
_ASSUAN_PREFIX(assuan_register_post_cmd_notify)
|
||||
#define assuan_register_bye_notify _ASSUAN_PREFIX(assuan_register_bye_notify)
|
||||
#define assuan_register_reset_notify \
|
||||
_ASSUAN_PREFIX(assuan_register_reset_notify)
|
||||
#define assuan_register_cancel_notify \
|
||||
_ASSUAN_PREFIX(assuan_register_cancel_notify)
|
||||
#define assuan_register_input_notify \
|
||||
_ASSUAN_PREFIX(assuan_register_input_notify)
|
||||
#define assuan_register_output_notify \
|
||||
_ASSUAN_PREFIX(assuan_register_output_notify)
|
||||
#define assuan_register_option_handler \
|
||||
_ASSUAN_PREFIX(assuan_register_option_handler)
|
||||
#define assuan_process _ASSUAN_PREFIX(assuan_process)
|
||||
#define assuan_process_next _ASSUAN_PREFIX(assuan_process_next)
|
||||
#define assuan_get_active_fds _ASSUAN_PREFIX(assuan_get_active_fds)
|
||||
#define assuan_get_data_fp _ASSUAN_PREFIX(assuan_get_data_fp)
|
||||
#define assuan_set_okay_line _ASSUAN_PREFIX(assuan_set_okay_line)
|
||||
#define assuan_write_status _ASSUAN_PREFIX(assuan_write_status)
|
||||
#define assuan_command_parse_fd _ASSUAN_PREFIX(assuan_command_parse_fd)
|
||||
#define assuan_set_hello_line _ASSUAN_PREFIX(assuan_set_hello_line)
|
||||
#define assuan_accept _ASSUAN_PREFIX(assuan_accept)
|
||||
#define assuan_get_input_fd _ASSUAN_PREFIX(assuan_get_input_fd)
|
||||
#define assuan_get_output_fd _ASSUAN_PREFIX(assuan_get_output_fd)
|
||||
#define assuan_close_input_fd _ASSUAN_PREFIX(assuan_close_input_fd)
|
||||
#define assuan_close_output_fd _ASSUAN_PREFIX(assuan_close_output_fd)
|
||||
#define assuan_init_pipe_server _ASSUAN_PREFIX(assuan_init_pipe_server)
|
||||
#define assuan_deinit_server _ASSUAN_PREFIX(assuan_deinit_server)
|
||||
#define assuan_init_socket_server _ASSUAN_PREFIX(assuan_init_socket_server)
|
||||
#define assuan_init_connected_socket_server \
|
||||
_ASSUAN_PREFIX(assuan_init_connected_socket_server)
|
||||
#define assuan_init_socket_server_ext \
|
||||
_ASSUAN_PREFIX(assuan_init_socket_server_ext)
|
||||
#define assuan_pipe_connect _ASSUAN_PREFIX(assuan_pipe_connect)
|
||||
#define assuan_pipe_connect_ext _ASSUAN_PREFIX(assuan_pipe_connect_ext)
|
||||
#define assuan_socket_connect _ASSUAN_PREFIX(assuan_socket_connect)
|
||||
#define assuan_socket_connect_ext _ASSUAN_PREFIX(assuan_socket_connect_ext)
|
||||
#define assuan_disconnect _ASSUAN_PREFIX(assuan_disconnect)
|
||||
#define assuan_get_pid _ASSUAN_PREFIX(assuan_get_pid)
|
||||
#define assuan_get_peercred _ASSUAN_PREFIX(assuan_get_peercred)
|
||||
#define assuan_transact _ASSUAN_PREFIX(assuan_transact)
|
||||
#define assuan_inquire _ASSUAN_PREFIX(assuan_inquire)
|
||||
#define assuan_read_line _ASSUAN_PREFIX(assuan_read_line)
|
||||
#define assuan_pending_line _ASSUAN_PREFIX(assuan_pending_line)
|
||||
#define assuan_write_line _ASSUAN_PREFIX(assuan_write_line)
|
||||
#define assuan_send_data _ASSUAN_PREFIX(assuan_send_data)
|
||||
#define assuan_sendfd _ASSUAN_PREFIX(assuan_sendfd)
|
||||
#define assuan_receivefd _ASSUAN_PREFIX(assuan_receivefd)
|
||||
#define assuan_set_malloc_hooks _ASSUAN_PREFIX(assuan_set_malloc_hooks)
|
||||
#define assuan_set_log_stream _ASSUAN_PREFIX(assuan_set_log_stream)
|
||||
#define assuan_set_error _ASSUAN_PREFIX(assuan_set_error)
|
||||
#define assuan_set_pointer _ASSUAN_PREFIX(assuan_set_pointer)
|
||||
#define assuan_get_pointer _ASSUAN_PREFIX(assuan_get_pointer)
|
||||
#define assuan_set_io_monitor _ASSUAN_PREFIX(assuan_set_io_monitor)
|
||||
#define assuan_begin_confidential _ASSUAN_PREFIX(assuan_begin_confidential)
|
||||
#define assuan_end_confidential _ASSUAN_PREFIX(assuan_end_confidential)
|
||||
#define assuan_strerror _ASSUAN_PREFIX(assuan_strerror)
|
||||
#define assuan_set_assuan_err_source \
|
||||
_ASSUAN_PREFIX(assuan_set_assuan_err_source)
|
||||
#define assuan_set_assuan_log_stream \
|
||||
_ASSUAN_PREFIX(assuan_set_assuan_log_stream)
|
||||
#define assuan_get_assuan_log_stream \
|
||||
_ASSUAN_PREFIX(assuan_get_assuan_log_stream)
|
||||
#define assuan_get_assuan_log_prefix \
|
||||
_ASSUAN_PREFIX(assuan_get_assuan_log_prefix)
|
||||
#define assuan_set_flag _ASSUAN_PREFIX(assuan_set_flag)
|
||||
#define assuan_get_flag _ASSUAN_PREFIX(assuan_get_flag)
|
||||
|
||||
/* And now the internal functions, argh... */
|
||||
#define _assuan_read_line _ASSUAN_PREFIX(_assuan_read_line)
|
||||
#define _assuan_cookie_write_data _ASSUAN_PREFIX(_assuan_cookie_write_data)
|
||||
#define _assuan_cookie_write_flush _ASSUAN_PREFIX(_assuan_cookie_write_flush)
|
||||
#define _assuan_read_from_server _ASSUAN_PREFIX(_assuan_read_from_server)
|
||||
#define _assuan_domain_init _ASSUAN_PREFIX(_assuan_domain_init)
|
||||
#define _assuan_register_std_commands \
|
||||
_ASSUAN_PREFIX(_assuan_register_std_commands)
|
||||
#define _assuan_simple_read _ASSUAN_PREFIX(_assuan_simple_read)
|
||||
#define _assuan_simple_write _ASSUAN_PREFIX(_assuan_simple_write)
|
||||
#define _assuan_simple_read _ASSUAN_PREFIX(_assuan_simple_read)
|
||||
#define _assuan_simple_write _ASSUAN_PREFIX(_assuan_simple_write)
|
||||
#define _assuan_new_context _ASSUAN_PREFIX(_assuan_new_context)
|
||||
#define _assuan_release_context _ASSUAN_PREFIX(_assuan_release_context)
|
||||
#define _assuan_malloc _ASSUAN_PREFIX(_assuan_malloc)
|
||||
#define _assuan_realloc _ASSUAN_PREFIX(_assuan_realloc)
|
||||
#define _assuan_calloc _ASSUAN_PREFIX(_assuan_calloc)
|
||||
#define _assuan_free _ASSUAN_PREFIX(_assuan_free)
|
||||
#define _assuan_log_print_buffer _ASSUAN_PREFIX(_assuan_log_print_buffer)
|
||||
#define _assuan_log_sanitized_string \
|
||||
_ASSUAN_PREFIX(_assuan_log_sanitized_string)
|
||||
#define _assuan_log_printf _ASSUAN_PREFIX(_assuan_log_printf)
|
||||
#define _assuan_set_default_log_stream \
|
||||
_ASSUAN_PREFIX(_assuan_set_default_log_stream)
|
||||
#define _assuan_w32_strerror _ASSUAN_PREFIX(_assuan_w32_strerror)
|
||||
#define _assuan_write_line _ASSUAN_PREFIX(_assuan_write_line)
|
||||
#define _assuan_close _ASSUAN_PREFIX(_assuan_close)
|
||||
#define _assuan_sock_new _ASSUAN_PREFIX(_assuan_sock_new)
|
||||
#define _assuan_sock_bind _ASSUAN_PREFIX(_assuan_sock_bind)
|
||||
#define _assuan_sock_connect _ASSUAN_PREFIX(_assuan_sock_connect)
|
||||
|
||||
#define _assuan_funopen _gpgme_funopen
|
||||
#endif /*_ASSUAN_EXT_SYM_PREFIX*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Check for compiler features. */
|
||||
#if __GNUC__
|
||||
#define _ASSUAN_GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ __GNUC_MINOR__ * 100 \
|
||||
+ __GNUC_PATCHLEVEL__)
|
||||
|
||||
#if _ASSUAN_GCC_VERSION > 30100
|
||||
#define _ASSUAN_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef _ASSUAN_DEPRECATED
|
||||
#define _ASSUAN_DEPRECATED
|
||||
#endif
|
||||
|
||||
|
||||
/* Assuan error codes. These are only used by old applications or
|
||||
those applications which won't make use of libgpg-error. */
|
||||
#ifndef _ASSUAN_ONLY_GPG_ERRORS
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_No_Error 0
|
||||
#endif
|
||||
#define ASSUAN_General_Error 1
|
||||
#define ASSUAN_Out_Of_Core 2
|
||||
#define ASSUAN_Invalid_Value 3
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Timeout 4
|
||||
#endif
|
||||
#define ASSUAN_Read_Error 5
|
||||
#define ASSUAN_Write_Error 6
|
||||
#define ASSUAN_Problem_Starting_Server 7
|
||||
#define ASSUAN_Not_A_Server 8
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Not_A_Client 9
|
||||
#endif
|
||||
#define ASSUAN_Nested_Commands 10
|
||||
#define ASSUAN_Invalid_Response 11
|
||||
#define ASSUAN_No_Data_Callback 12
|
||||
#define ASSUAN_No_Inquire_Callback 13
|
||||
#define ASSUAN_Connect_Failed 14
|
||||
#define ASSUAN_Accept_Failed 15
|
||||
|
||||
/* Error codes above 99 are meant as status codes */
|
||||
#define ASSUAN_Not_Implemented 100
|
||||
#define ASSUAN_Server_Fault 101
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Invalid_Command 102
|
||||
#endif
|
||||
#define ASSUAN_Unknown_Command 103
|
||||
#define ASSUAN_Syntax_Error 104
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Parameter_Error 105
|
||||
#endif
|
||||
#define ASSUAN_Parameter_Conflict 106
|
||||
#define ASSUAN_Line_Too_Long 107
|
||||
#define ASSUAN_Line_Not_Terminated 108
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_No_Input 109
|
||||
#define ASSUAN_No_Output 110
|
||||
#endif
|
||||
#define ASSUAN_Canceled 111
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Unsupported_Algorithm 112
|
||||
#define ASSUAN_Server_Resource_Problem 113
|
||||
#define ASSUAN_Server_IO_Error 114
|
||||
#define ASSUAN_Server_Bug 115
|
||||
#define ASSUAN_No_Data_Available 116
|
||||
#define ASSUAN_Invalid_Data 117
|
||||
#endif
|
||||
#define ASSUAN_Unexpected_Command 118
|
||||
#define ASSUAN_Too_Much_Data 119
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Inquire_Unknown 120
|
||||
#define ASSUAN_Inquire_Error 121
|
||||
#define ASSUAN_Invalid_Option 122
|
||||
#define ASSUAN_Invalid_Index 123
|
||||
#define ASSUAN_Unexpected_Status 124
|
||||
#define ASSUAN_Unexpected_Data 125
|
||||
#define ASSUAN_Invalid_Status 126
|
||||
#define ASSUAN_Locale_Problem 127
|
||||
#endif
|
||||
#define ASSUAN_Not_Confirmed 128
|
||||
|
||||
/* Warning: Don't use the Error codes, below they are deprecated. */
|
||||
#ifndef _ASSUAN_IN_LIBASSUAN
|
||||
#define ASSUAN_Bad_Certificate 201
|
||||
#define ASSUAN_Bad_Certificate_Chain 202
|
||||
#define ASSUAN_Missing_Certificate 203
|
||||
#define ASSUAN_Bad_Signature 204
|
||||
#define ASSUAN_No_Agent 205
|
||||
#define ASSUAN_Agent_Error 206
|
||||
#define ASSUAN_No_Public_Key 207
|
||||
#define ASSUAN_No_Secret_Key 208
|
||||
#define ASSUAN_Invalid_Name 209
|
||||
|
||||
#define ASSUAN_Cert_Revoked 301
|
||||
#define ASSUAN_No_CRL_For_Cert 302
|
||||
#define ASSUAN_CRL_Too_Old 303
|
||||
#define ASSUAN_Not_Trusted 304
|
||||
|
||||
#define ASSUAN_Card_Error 401
|
||||
#define ASSUAN_Invalid_Card 402
|
||||
#define ASSUAN_No_PKCS15_App 403
|
||||
#define ASSUAN_Card_Not_Present 404
|
||||
#define ASSUAN_Invalid_Id 405
|
||||
|
||||
/* Error codes in the range 1000 to 9999 may be used by applications
|
||||
at their own discretion. */
|
||||
#define ASSUAN_USER_ERROR_FIRST 1000
|
||||
#define ASSUAN_USER_ERROR_LAST 9999
|
||||
#endif
|
||||
|
||||
typedef int assuan_error_t;
|
||||
|
||||
typedef assuan_error_t AssuanError _ASSUAN_DEPRECATED;
|
||||
|
||||
/* This is a list of pre-registered ASSUAN commands */
|
||||
/* Note, these command IDs are now deprectated and solely exists for
|
||||
compatibility reasons. */
|
||||
typedef enum
|
||||
{
|
||||
ASSUAN_CMD_NOP = 0,
|
||||
ASSUAN_CMD_CANCEL, /* cancel the current request */
|
||||
ASSUAN_CMD_BYE,
|
||||
ASSUAN_CMD_AUTH,
|
||||
ASSUAN_CMD_RESET,
|
||||
ASSUAN_CMD_OPTION,
|
||||
ASSUAN_CMD_DATA,
|
||||
ASSUAN_CMD_END,
|
||||
ASSUAN_CMD_INPUT,
|
||||
ASSUAN_CMD_OUTPUT,
|
||||
|
||||
ASSUAN_CMD_USER = 256 /* Other commands should be used with this offset*/
|
||||
} AssuanCommand;
|
||||
|
||||
|
||||
#else /*!_ASSUAN_ONLY_GPG_ERRORS*/
|
||||
|
||||
typedef int assuan_error_t;
|
||||
|
||||
#endif /*!_ASSUAN_ONLY_GPG_ERRORS*/
|
||||
|
||||
|
||||
/* Definitions of flags for assuan_set_flag(). */
|
||||
typedef enum
|
||||
{
|
||||
/* When using a pipe server, by default Assuan will wait for the
|
||||
forked process to die in assuan_disconnect. In certain cases
|
||||
this is not desirable. By setting this flag, the waitpid will
|
||||
be skipped and the caller is responsible to cleanup a forked
|
||||
process. */
|
||||
ASSUAN_NO_WAITPID = 1
|
||||
}
|
||||
assuan_flag_t;
|
||||
|
||||
#define ASSUAN_LINELENGTH 1002 /* 1000 + [CR,]LF */
|
||||
|
||||
struct assuan_context_s;
|
||||
typedef struct assuan_context_s *assuan_context_t;
|
||||
#ifndef _ASSUAN_ONLY_GPG_ERRORS
|
||||
typedef struct assuan_context_s *ASSUAN_CONTEXT _ASSUAN_DEPRECATED;
|
||||
#endif /*_ASSUAN_ONLY_GPG_ERRORS*/
|
||||
|
||||
/*-- assuan-handler.c --*/
|
||||
int assuan_register_command (assuan_context_t ctx,
|
||||
const char *cmd_string,
|
||||
int (*handler)(assuan_context_t, char *));
|
||||
int assuan_register_post_cmd_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t, int));
|
||||
int assuan_register_bye_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t));
|
||||
int assuan_register_reset_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t));
|
||||
int assuan_register_cancel_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t));
|
||||
int assuan_register_input_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t, const char *));
|
||||
int assuan_register_output_notify (assuan_context_t ctx,
|
||||
void (*fnc)(assuan_context_t, const char *));
|
||||
|
||||
int assuan_register_option_handler (assuan_context_t ctx,
|
||||
int (*fnc)(assuan_context_t,
|
||||
const char*, const char*));
|
||||
|
||||
int assuan_process (assuan_context_t ctx);
|
||||
int assuan_process_next (assuan_context_t ctx);
|
||||
int assuan_get_active_fds (assuan_context_t ctx, int what,
|
||||
int *fdarray, int fdarraysize);
|
||||
|
||||
|
||||
FILE *assuan_get_data_fp (assuan_context_t ctx);
|
||||
assuan_error_t assuan_set_okay_line (assuan_context_t ctx, const char *line);
|
||||
assuan_error_t assuan_write_status (assuan_context_t ctx,
|
||||
const char *keyword, const char *text);
|
||||
|
||||
/* Negotiate a file descriptor. If LINE contains "FD=N", returns N
|
||||
assuming a local file descriptor. If LINE contains "FD" reads a
|
||||
file descriptor via CTX and stores it in *RDF (the CTX must be
|
||||
capable of passing file descriptors). */
|
||||
assuan_error_t assuan_command_parse_fd (assuan_context_t ctx, char *line,
|
||||
int *rfd);
|
||||
|
||||
/*-- assuan-listen.c --*/
|
||||
assuan_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line);
|
||||
assuan_error_t assuan_accept (assuan_context_t ctx);
|
||||
int assuan_get_input_fd (assuan_context_t ctx);
|
||||
int assuan_get_output_fd (assuan_context_t ctx);
|
||||
assuan_error_t assuan_close_input_fd (assuan_context_t ctx);
|
||||
assuan_error_t assuan_close_output_fd (assuan_context_t ctx);
|
||||
|
||||
|
||||
/*-- assuan-pipe-server.c --*/
|
||||
int assuan_init_pipe_server (assuan_context_t *r_ctx, int filedes[2]);
|
||||
void assuan_deinit_server (assuan_context_t ctx);
|
||||
|
||||
/*-- assuan-socket-server.c --*/
|
||||
int assuan_init_socket_server (assuan_context_t *r_ctx, int listen_fd);
|
||||
int assuan_init_connected_socket_server (assuan_context_t *r_ctx,
|
||||
int fd) _ASSUAN_DEPRECATED;
|
||||
int assuan_init_socket_server_ext (assuan_context_t *r_ctx, int fd,
|
||||
unsigned int flags);
|
||||
|
||||
/*-- assuan-pipe-connect.c --*/
|
||||
assuan_error_t assuan_pipe_connect (assuan_context_t *ctx,
|
||||
const char *name,
|
||||
const char *const argv[],
|
||||
int *fd_child_list);
|
||||
assuan_error_t assuan_pipe_connect2 (assuan_context_t *ctx,
|
||||
const char *name,
|
||||
const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void*, int),
|
||||
void *atforkvalue) _ASSUAN_DEPRECATED;
|
||||
assuan_error_t assuan_pipe_connect_ext (assuan_context_t *ctx,
|
||||
const char *name,
|
||||
const char *const argv[],
|
||||
int *fd_child_list,
|
||||
void (*atfork) (void *, int),
|
||||
void *atforkvalue,
|
||||
unsigned int flags);
|
||||
|
||||
/*-- assuan-socket-connect.c --*/
|
||||
assuan_error_t assuan_socket_connect (assuan_context_t *ctx,
|
||||
const char *name,
|
||||
pid_t server_pid);
|
||||
assuan_error_t assuan_socket_connect_ext (assuan_context_t *ctx,
|
||||
const char *name,
|
||||
pid_t server_pid,
|
||||
unsigned int flags);
|
||||
|
||||
/*-- assuan-connect.c --*/
|
||||
void assuan_disconnect (assuan_context_t ctx);
|
||||
pid_t assuan_get_pid (assuan_context_t ctx);
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
assuan_error_t assuan_get_peercred (assuan_context_t ctx,
|
||||
pid_t *pid, uid_t *uid, gid_t *gid);
|
||||
#endif
|
||||
|
||||
/*-- assuan-client.c --*/
|
||||
assuan_error_t
|
||||
assuan_transact (assuan_context_t ctx,
|
||||
const char *command,
|
||||
int (*data_cb)(void *, const void *, size_t),
|
||||
void *data_cb_arg,
|
||||
int (*inquire_cb)(void*, const char *),
|
||||
void *inquire_cb_arg,
|
||||
int (*status_cb)(void*, const char *),
|
||||
void *status_cb_arg);
|
||||
|
||||
|
||||
/*-- assuan-inquire.c --*/
|
||||
assuan_error_t assuan_inquire (assuan_context_t ctx, const char *keyword,
|
||||
unsigned char **r_buffer, size_t *r_length,
|
||||
size_t maxlen);
|
||||
|
||||
/*-- assuan-buffer.c --*/
|
||||
assuan_error_t assuan_read_line (assuan_context_t ctx,
|
||||
char **line, size_t *linelen);
|
||||
int assuan_pending_line (assuan_context_t ctx);
|
||||
assuan_error_t assuan_write_line (assuan_context_t ctx, const char *line );
|
||||
assuan_error_t assuan_send_data (assuan_context_t ctx,
|
||||
const void *buffer, size_t length);
|
||||
|
||||
/* The file descriptor must be pending before assuan_receivefd is
|
||||
called. This means that assuan_sendfd should be called *before* the
|
||||
trigger is sent (normally via assuan_write_line ("INPUT FD")). */
|
||||
assuan_error_t assuan_sendfd (assuan_context_t ctx, int fd);
|
||||
assuan_error_t assuan_receivefd (assuan_context_t ctx, int *fd);
|
||||
|
||||
/*-- assuan-util.c --*/
|
||||
void assuan_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
|
||||
void *(*new_realloc_func)(void *p, size_t n),
|
||||
void (*new_free_func)(void*) );
|
||||
void assuan_set_log_stream (assuan_context_t ctx, FILE *fp);
|
||||
int assuan_set_error (assuan_context_t ctx, int err, const char *text);
|
||||
void assuan_set_pointer (assuan_context_t ctx, void *pointer);
|
||||
void *assuan_get_pointer (assuan_context_t ctx);
|
||||
|
||||
void assuan_begin_confidential (assuan_context_t ctx);
|
||||
void assuan_end_confidential (assuan_context_t ctx);
|
||||
|
||||
void assuan_set_io_monitor (assuan_context_t ctx,
|
||||
unsigned int (*monitor)(assuan_context_t ctx,
|
||||
int direction,
|
||||
const char *line,
|
||||
size_t linelen));
|
||||
|
||||
/* For context CTX, set the flag FLAG to VALUE. Values for flags
|
||||
are usually 1 or 0 but certain flags might allow for other values;
|
||||
see the description of the type assuan_flag_t for details. */
|
||||
void assuan_set_flag (assuan_context_t ctx, assuan_flag_t flag, int value);
|
||||
|
||||
/* Return the VALUE of FLAG in context CTX. */
|
||||
int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag);
|
||||
|
||||
|
||||
/*-- assuan-errors.c --*/
|
||||
|
||||
#ifndef _ASSUAN_ONLY_GPG_ERRORS
|
||||
/* Return a string describing the assuan error. The use of this
|
||||
function is deprecated; it is better to call
|
||||
assuan_set_assuan_err_source once and then make use libgpg-error. */
|
||||
const char *assuan_strerror (assuan_error_t err);
|
||||
#endif /*_ASSUAN_ONLY_GPG_ERRORS*/
|
||||
|
||||
/* Enable gpg-error style error codes. ERRSOURCE is one of gpg-error
|
||||
sources. Note, that this function is not thread-safe and should be
|
||||
used right at startup. Switching back to the old style mode is not
|
||||
supported. */
|
||||
void assuan_set_assuan_err_source (int errsource);
|
||||
|
||||
/*-- assuan-logging.c --*/
|
||||
|
||||
/* Set the stream to which assuan should log message not associated
|
||||
with a context. By default, this is stderr. The default value
|
||||
will be changed when the first log stream is associated with a
|
||||
context. Note, that this function is not thread-safe and should
|
||||
in general be used right at startup. */
|
||||
extern void assuan_set_assuan_log_stream (FILE *fp);
|
||||
|
||||
/* Return the stream which is currently being using for global logging. */
|
||||
extern FILE *assuan_get_assuan_log_stream (void);
|
||||
|
||||
/* Set the prefix to be used at the start of a line emitted by assuan
|
||||
on the log stream. The default is the empty string. Note, that
|
||||
this function is not thread-safe and should in general be used
|
||||
right at startup. */
|
||||
void assuan_set_assuan_log_prefix (const char *text);
|
||||
|
||||
/* Return a prefix to be used at the start of a line emitted by assuan
|
||||
on the log stream. The default implementation returns the empty
|
||||
string, i.e. "" */
|
||||
const char *assuan_get_assuan_log_prefix (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ASSUAN_H */
|
228
tags/gpgme-1.1.5/assuan/mkerrors
Executable file
228
tags/gpgme-1.1.5/assuan/mkerrors
Executable file
@ -0,0 +1,228 @@
|
||||
#!/bin/sh
|
||||
# mkerrors - Extract error strings from assuan.h
|
||||
# and create C source for assuan_strerror
|
||||
# Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of Assuan.
|
||||
#
|
||||
# Assuan is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# Assuan is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
cat <<EOF
|
||||
/* Generated automatically by mkerrors */
|
||||
/* Do not edit! See mkerrors for copyright notice. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#undef _ASSUAN_IN_LIBASSUAN /* undef to get all error codes. */
|
||||
#include "assuan.h"
|
||||
|
||||
/* If true the modern gpg-error style error codes are used in the
|
||||
API. */
|
||||
static unsigned int err_source;
|
||||
|
||||
/* Enable gpg-error style error codes. ERRSOURCE is one of gpg-error
|
||||
sources. Note, that this function is not thread-safe and should be
|
||||
used right at startup. Switching back to the old style mode is not
|
||||
supported. */
|
||||
void
|
||||
assuan_set_assuan_err_source (int errsource)
|
||||
{
|
||||
errsource &= 0xff;
|
||||
err_source = errsource? errsource : 31 /*GPG_ERR_SOURCE_ANY*/;
|
||||
}
|
||||
|
||||
|
||||
/* Helper to map old style Assuan error codes to gpg-error codes.
|
||||
This is used internally to keep an compatible ABI. */
|
||||
assuan_error_t
|
||||
_assuan_error (int oldcode)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
if (!err_source)
|
||||
return (oldcode & 0x00ffffff); /* Make sure that the gpg-error
|
||||
source part is cleared. */
|
||||
|
||||
switch (oldcode)
|
||||
{
|
||||
case ASSUAN_General_Error: n = 257; break;
|
||||
case ASSUAN_Accept_Failed: n = 258; break;
|
||||
case ASSUAN_Connect_Failed: n = 259; break;
|
||||
case ASSUAN_Invalid_Response: n = 260; break;
|
||||
case ASSUAN_Invalid_Value: n = 261; break;
|
||||
case ASSUAN_Line_Not_Terminated: n = 262; break;
|
||||
case ASSUAN_Line_Too_Long: n = 263; break;
|
||||
case ASSUAN_Nested_Commands: n = 264; break;
|
||||
case ASSUAN_No_Data_Callback: n = 265; break;
|
||||
case ASSUAN_No_Inquire_Callback: n = 266; break;
|
||||
case ASSUAN_Not_A_Server: n = 267; break;
|
||||
case ASSUAN_Not_Implemented: n = 69; break;
|
||||
case ASSUAN_Parameter_Conflict: n = 280; break;
|
||||
case ASSUAN_Problem_Starting_Server: n = 269; break;
|
||||
case ASSUAN_Server_Fault: n = 80; break;
|
||||
case ASSUAN_Syntax_Error: n = 276; break;
|
||||
case ASSUAN_Too_Much_Data: n = 273; break;
|
||||
case ASSUAN_Unexpected_Command: n = 274; break;
|
||||
case ASSUAN_Unknown_Command: n = 275; break;
|
||||
case ASSUAN_Canceled: n = 277; break;
|
||||
case ASSUAN_No_Secret_Key: n = 17; break;
|
||||
case ASSUAN_Not_Confirmed: n = 114; break;
|
||||
|
||||
case ASSUAN_Read_Error:
|
||||
switch (errno)
|
||||
{
|
||||
case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break;
|
||||
default: n = 270; /*GPG_ERR_ASS_READ_ERROR*/ break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASSUAN_Write_Error:
|
||||
switch (errno)
|
||||
{
|
||||
case 0: n = 16381; /*GPG_ERR_MISSING_ERRNO*/ break;
|
||||
default: n = 271; /*GPG_ERR_ASS_WRITE_ERROR*/ break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ASSUAN_Out_Of_Core:
|
||||
switch (errno)
|
||||
{
|
||||
case 0: /* Should not happen but a user might have provided
|
||||
an incomplete implemented malloc function. Give
|
||||
him a chance to correct this fault but make sure
|
||||
an error is indeed returned. */
|
||||
n = 16381; /*GPG_ERR_MISSING_ERRNO*/
|
||||
break;
|
||||
case ENOMEM: n = (1 << 15) | 86; break;
|
||||
default:
|
||||
n = 16382; /*GPG_ERR_UNKNOWN_ERRNO*/
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case -1: n = 16383 /*GPG_ERR_EOF*/; break;
|
||||
|
||||
default:
|
||||
n = 257;
|
||||
break;
|
||||
}
|
||||
|
||||
return ((err_source << 24) | (n & 0x00ffffff));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* assuan_strerror:
|
||||
* @err: Error code
|
||||
*
|
||||
* This function returns a textual representaion of the given
|
||||
* errorcode. If this is an unknown value, a string with the value
|
||||
* is returned (Beware: it is hold in a static buffer).
|
||||
*
|
||||
* Return value: String with the error description.
|
||||
**/
|
||||
const char *
|
||||
assuan_strerror (assuan_error_t err)
|
||||
{
|
||||
const char *s;
|
||||
static char buf[50];
|
||||
|
||||
switch (err)
|
||||
{
|
||||
EOF
|
||||
|
||||
awk '
|
||||
/ASSUAN_No_Error/ { okay=1 }
|
||||
!okay {next}
|
||||
/^#define[ ]+ASSUAN_[A-Za-z_]*/ { print_code($2) }
|
||||
/ASSUAN_USER_ERROR_LAST/ { exit 0 }
|
||||
|
||||
|
||||
function print_code( s )
|
||||
{
|
||||
printf " case %s: s=\"", s ;
|
||||
gsub(/_/, " ", s );
|
||||
printf "%s\"; break;\n", tolower(substr(s,8));
|
||||
}
|
||||
'
|
||||
|
||||
cat <<EOF
|
||||
case -1: s = "EOF (-1)"; break;
|
||||
default:
|
||||
{
|
||||
unsigned int source, code, n;
|
||||
|
||||
source = ((err >> 24) & 0xff);
|
||||
code = (err & 0x00ffffff);
|
||||
if (source)
|
||||
{
|
||||
/* Assume this is an libgpg-error and try to map the codes
|
||||
back. */
|
||||
switch (code)
|
||||
{
|
||||
case 257: n = ASSUAN_General_Error ; break;
|
||||
case 258: n = ASSUAN_Accept_Failed ; break;
|
||||
case 259: n = ASSUAN_Connect_Failed ; break;
|
||||
case 260: n = ASSUAN_Invalid_Response ; break;
|
||||
case 261: n = ASSUAN_Invalid_Value ; break;
|
||||
case 262: n = ASSUAN_Line_Not_Terminated ; break;
|
||||
case 263: n = ASSUAN_Line_Too_Long ; break;
|
||||
case 264: n = ASSUAN_Nested_Commands ; break;
|
||||
case 265: n = ASSUAN_No_Data_Callback ; break;
|
||||
case 266: n = ASSUAN_No_Inquire_Callback ; break;
|
||||
case 267: n = ASSUAN_Not_A_Server ; break;
|
||||
case 69: n = ASSUAN_Not_Implemented ; break;
|
||||
case 280: n = ASSUAN_Parameter_Conflict ; break;
|
||||
case 269: n = ASSUAN_Problem_Starting_Server; break;
|
||||
case 270: n = ASSUAN_Read_Error ; break;
|
||||
case 271: n = ASSUAN_Write_Error ; break;
|
||||
case 80: n = ASSUAN_Server_Fault ; break;
|
||||
case 276: n = ASSUAN_Syntax_Error ; break;
|
||||
case 273: n = ASSUAN_Too_Much_Data ; break;
|
||||
case 274: n = ASSUAN_Unexpected_Command ; break;
|
||||
case 275: n = ASSUAN_Unknown_Command ; break;
|
||||
case 277: n = ASSUAN_Canceled ; break;
|
||||
case 114: n = ASSUAN_Not_Confirmed ; break;
|
||||
case ((1<<15)|86): n = ASSUAN_Out_Of_Core ; break;
|
||||
default: n = 0; break;
|
||||
}
|
||||
if (n)
|
||||
s = assuan_strerror (n);
|
||||
else
|
||||
{
|
||||
sprintf (buf, "ec=%u.%u", source, code );
|
||||
s=buf;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (buf, "ec=%d", err );
|
||||
s=buf;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
EOF
|
162
tags/gpgme-1.1.5/autogen.sh
Executable file
162
tags/gpgme-1.1.5/autogen.sh
Executable file
@ -0,0 +1,162 @@
|
||||
#! /bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
#
|
||||
# Copyright (C) 2003 g10 Code GmbH
|
||||
#
|
||||
# This file is free software; as a special exception the author 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.
|
||||
|
||||
configure_ac="configure.ac"
|
||||
|
||||
cvtver () {
|
||||
awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
|
||||
}
|
||||
|
||||
check_version () {
|
||||
if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
|
||||
return 0
|
||||
fi
|
||||
echo "**Error**: "\`$1\'" not installed or too old." >&2
|
||||
echo ' Version '$3' or newer is required.' >&2
|
||||
[ -n "$4" ] && echo ' Note that this is part of '\`$4\''.' >&2
|
||||
DIE="yes"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
DIE=no
|
||||
FORCE=
|
||||
if test "$1" = "--force"; then
|
||||
FORCE=" --force"
|
||||
shift
|
||||
fi
|
||||
|
||||
# Used to cross-compile for Windows.
|
||||
if test "$1" = "--build-w32"; then
|
||||
tmp=`dirname $0`
|
||||
tsdir=`cd "$tmp"; pwd`
|
||||
shift
|
||||
if [ ! -f $tsdir/config.guess ]; then
|
||||
echo "$tsdir/config.guess not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
build=`$tsdir/config.guess`
|
||||
|
||||
[ -z "$w32root" ] && w32root="$HOME/w32root"
|
||||
echo "Using $w32root as standard install directory" >&2
|
||||
|
||||
# See whether we have the Debian cross compiler package or the
|
||||
# old mingw32/cpd system
|
||||
if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then
|
||||
host=i586-mingw32msvc
|
||||
crossbindir=/usr/$host/bin
|
||||
else
|
||||
host=i386--mingw32
|
||||
if ! mingw32 --version >/dev/null; then
|
||||
echo "We need at least version 0.3 of MingW32/CPD" >&2
|
||||
exit 1
|
||||
fi
|
||||
crossbindir=`mingw32 --install-dir`/bin
|
||||
# Old autoconf version required us to setup the environment
|
||||
# with the proper tool names.
|
||||
CC=`mingw32 --get-path gcc`
|
||||
CPP=`mingw32 --get-path cpp`
|
||||
AR=`mingw32 --get-path ar`
|
||||
RANLIB=`mingw32 --get-path ranlib`
|
||||
export CC CPP AR RANLIB
|
||||
fi
|
||||
|
||||
if [ -f "$tsdir/config.log" ]; then
|
||||
if ! head $tsdir/config.log | grep "$host" >/dev/null; then
|
||||
echo "Pease run a 'make distclean' first" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
./configure --enable-maintainer-mode --prefix=${w32root} \
|
||||
--host=i586-mingw32msvc --build=${build} \
|
||||
--with-gpg-error-prefix=${w32root} --without-gpgsm \
|
||||
--enable-shared --enable-static --enable-w32-glib \
|
||||
PKG_CONFIG_LIBDIR="$w32root/lib/pkgconfig"
|
||||
|
||||
exit $?
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Grep the required versions from configure.ac
|
||||
autoconf_vers=`sed -n '/^AC_PREREQ(/ {
|
||||
s/^.*(\(.*\))/\1/p
|
||||
q
|
||||
}' ${configure_ac}`
|
||||
autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
|
||||
|
||||
automake_vers=`sed -n '/^min_automake_version=/ {
|
||||
s/^.*="\(.*\)"/\1/p
|
||||
q
|
||||
}' ${configure_ac}`
|
||||
automake_vers_num=`echo "$automake_vers" | cvtver`
|
||||
|
||||
#gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
|
||||
#s/^.*(\(.*\))/\1/p
|
||||
#q
|
||||
#}' ${configure_ac}`
|
||||
#gettext_vers_num=`echo "$gettext_vers" | cvtver`
|
||||
|
||||
|
||||
if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
|
||||
then
|
||||
echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Allow to override the default tool names
|
||||
AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
|
||||
AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
|
||||
|
||||
AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
|
||||
ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
|
||||
|
||||
#GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
|
||||
#MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
|
||||
|
||||
DIE=no
|
||||
|
||||
|
||||
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
|
||||
check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
|
||||
fi
|
||||
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
|
||||
check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
|
||||
fi
|
||||
#if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
|
||||
# check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
|
||||
#fi
|
||||
|
||||
if test "$DIE" = "yes"; then
|
||||
cat <<EOF
|
||||
|
||||
Note that you may use alternative versions of the tools by setting
|
||||
the corresponding environment variables; see README.CVS for details.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
|
||||
$ACLOCAL -I m4 $ACLOCAL_FLAGS
|
||||
echo "Running autoheader..."
|
||||
$AUTOHEADER
|
||||
echo "Running automake --gnu ..."
|
||||
$AUTOMAKE --gnu;
|
||||
echo "Running autoconf${FORCE} ..."
|
||||
$AUTOCONF${FORCE}
|
||||
|
||||
echo "You may now run \"./configure --enable-maintainer-mode && make\"."
|
99
tags/gpgme-1.1.5/compile
Executable file
99
tags/gpgme-1.1.5/compile
Executable file
@ -0,0 +1,99 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Usage:
|
||||
# compile PROGRAM [ARGS]...
|
||||
# `-o FOO.o' is removed from the args passed to the actual compile.
|
||||
|
||||
prog=$1
|
||||
shift
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
args=
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we do something ugly here.
|
||||
ofile=$2
|
||||
shift
|
||||
case "$ofile" in
|
||||
*.o | *.obj)
|
||||
;;
|
||||
*)
|
||||
args="$args -o $ofile"
|
||||
ofile=
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
args="$args $1"
|
||||
;;
|
||||
*)
|
||||
args="$args $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$prog" $args
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir $lockdir > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir $lockdir; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$prog" $args
|
||||
status=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir $lockdir
|
||||
exit $status
|
15
tags/gpgme-1.1.5/complus/ChangeLog
Normal file
15
tags/gpgme-1.1.5/complus/ChangeLog
Normal file
@ -0,0 +1,15 @@
|
||||
2001-07-30 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Encryption basically works.
|
||||
|
||||
|
||||
Copyright 2001 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
||||
|
49
tags/gpgme-1.1.5/complus/Makefile.am
Normal file
49
tags/gpgme-1.1.5/complus/Makefile.am
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
# Copyright (C) 2001 g10 Code GmbH
|
||||
#
|
||||
# This file is part of GPGME.
|
||||
#
|
||||
# GPGME 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.
|
||||
#
|
||||
# GPGME 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
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# Because WIDL does not yet fully support generation of typelibs, we
|
||||
# have to distribute a binary type library. To generate a new one,
|
||||
# copy the idl file to a system with an install MIDL and run the
|
||||
# command "midl /nocpp gpgcom.idl". Sorry, there is no other way yet.
|
||||
|
||||
EXTRA_DIST = gpgcom.idl gpgcom.tlb gpgcom.rc vbtest.html vbtest.vbs README
|
||||
|
||||
# No need to install this because we are cross-compiling anyway.
|
||||
noinst_PROGRAMS = gpgcom tgpgcom
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/jnlib
|
||||
LDADD = ../gpgme/libgpgme.la -L ../jnlib -ljnlib -lole32 -loleaut32
|
||||
gpgcom_LDADD = gpgcom_res.o $(LDADD)
|
||||
|
||||
gpgcom_SOURCES = gpgcom.c main.h \
|
||||
debug.c utf8.c \
|
||||
igpgme.h igpgme.c
|
||||
|
||||
tgpgcom_SOURCES = tgpgcom.c\
|
||||
debug.c \
|
||||
igpgme.h
|
||||
|
||||
#regtlb_SOURCES = regtlb.c
|
||||
#guidgen_SOURCES = guidgen.c
|
||||
|
||||
gpgcom_res.o: gpgcom.rc
|
||||
mingw32 windres $< gpgcom_res.o
|
||||
|
72
tags/gpgme-1.1.5/complus/README
Normal file
72
tags/gpgme-1.1.5/complus/README
Normal file
@ -0,0 +1,72 @@
|
||||
How to install and use the Gpgcom Windows Component
|
||||
===================================================
|
||||
2001-07-31
|
||||
|
||||
|
||||
Installation should be pretty easy:
|
||||
-----------------------------------
|
||||
|
||||
* Get and install the latest GnuPG binary for windows
|
||||
(ftp://ftp.gnupg.org/gcrypt/binary/gnupg-w32-1.0.6.zip)
|
||||
|
||||
* Check that you have an untampered version of this package by
|
||||
comparing an MD5SUM against the one on the webpage or by checking
|
||||
the signature of the package using "gpg --verify". See the
|
||||
webpacge for details.
|
||||
|
||||
* Because you are reading this file, you probably have already
|
||||
unpacked it distribution using a unzip utility :-). You should
|
||||
find these files:
|
||||
|
||||
README - This file
|
||||
gpgcom.exe - The Gpgcom server
|
||||
vbtest.html - A Test webpage
|
||||
vbtest.vbs - A VB script to be used with the cscript utility
|
||||
|
||||
* If you are updating Gpgcom, run the old Gpgcom like this:
|
||||
|
||||
c:\gnupg\gpgcom -UnregServer
|
||||
|
||||
(Replace c:\gnupg with the actually used path)
|
||||
|
||||
* Copy the file gpgcom.exe to a some location. C:\gnupg seems to be
|
||||
a good choice.
|
||||
|
||||
* Register the component using this command:
|
||||
|
||||
c:\gnupg\gpgcom -RegServer
|
||||
|
||||
* Ready
|
||||
|
||||
Testing the installation:
|
||||
-------------------------
|
||||
|
||||
* Make sure that you have a working GnuPG (gpg.exe) and that at least
|
||||
one key is installed.
|
||||
|
||||
* Edit the vbtest.vbs script and replace "alice" in the line
|
||||
|
||||
gpg.AddRecipient "alice"
|
||||
|
||||
with a keyID or user name you have in your key ring.
|
||||
|
||||
* Run the test script:
|
||||
|
||||
cscript vbtest.vbs
|
||||
|
||||
and you should see a valid MIME message with the encrypted text.
|
||||
|
||||
|
||||
Using Gpgcom
|
||||
------------
|
||||
|
||||
Gpgcom currently support only encryption but will be extended to the
|
||||
full range of operations GnuPG provides. The 2 examples should goive
|
||||
yopu a hint on how to use it. We suggest that you always set armor to
|
||||
true, so that the returned text is a string. If you don't use armor,
|
||||
the "ciphertext" property will return an array with the binary
|
||||
message.
|
||||
|
||||
|
||||
|
||||
|
40
tags/gpgme-1.1.5/complus/debug.c
Normal file
40
tags/gpgme-1.1.5/complus/debug.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* debug.c - COM+ debug helpers
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <ole2.h>
|
||||
|
||||
|
||||
const char *
|
||||
debugstr_guid (const GUID *id)
|
||||
{
|
||||
static char str[100];
|
||||
|
||||
if (!id)
|
||||
return "(null)";
|
||||
sprintf( str, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
id->Data1, id->Data2, id->Data3,
|
||||
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
|
||||
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
|
||||
return str;
|
||||
}
|
||||
|
598
tags/gpgme-1.1.5/complus/example.c
Normal file
598
tags/gpgme-1.1.5/complus/example.c
Normal file
@ -0,0 +1,598 @@
|
||||
/*
|
||||
* Copyright 1999 Marcus Meissner
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "mmsystem.h"
|
||||
#include "winerror.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
#include "initguid.h"
|
||||
#include "vfw.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(avifile);
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj);
|
||||
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface);
|
||||
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface);
|
||||
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size);
|
||||
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
|
||||
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
|
||||
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size);
|
||||
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size);
|
||||
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface);
|
||||
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam);
|
||||
|
||||
struct ICOM_VTABLE(IAVIFile) iavift = {
|
||||
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
||||
IAVIFile_fnQueryInterface,
|
||||
IAVIFile_fnAddRef,
|
||||
IAVIFile_fnRelease,
|
||||
IAVIFile_fnInfo,
|
||||
IAVIFile_fnGetStream,
|
||||
IAVIFile_fnCreateStream,
|
||||
IAVIFile_fnWriteData,
|
||||
IAVIFile_fnReadData,
|
||||
IAVIFile_fnEndRecord,
|
||||
IAVIFile_fnDeleteStream
|
||||
};
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj);
|
||||
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface);
|
||||
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface);
|
||||
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2);
|
||||
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size);
|
||||
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags);
|
||||
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize);
|
||||
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize);
|
||||
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
|
||||
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
|
||||
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples);
|
||||
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread);
|
||||
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size);
|
||||
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen);
|
||||
|
||||
struct ICOM_VTABLE(IAVIStream) iavist = {
|
||||
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
||||
IAVIStream_fnQueryInterface,
|
||||
IAVIStream_fnAddRef,
|
||||
IAVIStream_fnRelease,
|
||||
IAVIStream_fnCreate,
|
||||
IAVIStream_fnInfo,
|
||||
IAVIStream_fnFindSample,
|
||||
IAVIStream_fnReadFormat,
|
||||
IAVIStream_fnSetFormat,
|
||||
IAVIStream_fnRead,
|
||||
IAVIStream_fnWrite,
|
||||
IAVIStream_fnDelete,
|
||||
IAVIStream_fnReadData,
|
||||
IAVIStream_fnWriteData,
|
||||
IAVIStream_fnSetInfo
|
||||
};
|
||||
|
||||
typedef struct IAVIStreamImpl {
|
||||
/* IUnknown stuff */
|
||||
ICOM_VFIELD(IAVIStream);
|
||||
DWORD ref;
|
||||
/* IAVIStream stuff */
|
||||
LPVOID lpInputFormat;
|
||||
DWORD inputformatsize;
|
||||
BOOL iscompressing;
|
||||
DWORD curframe;
|
||||
|
||||
/* Compressor stuff */
|
||||
HIC hic;
|
||||
LPVOID lpCompressFormat;
|
||||
ICINFO icinfo;
|
||||
DWORD compbufsize;
|
||||
LPVOID compbuffer;
|
||||
|
||||
DWORD decompbufsize;
|
||||
LPVOID decompbuffer;
|
||||
LPVOID decompformat;
|
||||
AVICOMPRESSOPTIONS aco;
|
||||
|
||||
LPVOID lpPrev; /* pointer to decompressed frame later */
|
||||
LPVOID lpPrevFormat; /* pointer to decompressed info later */
|
||||
} IAVIStreamImpl;
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileInit
|
||||
*/
|
||||
void WINAPI
|
||||
AVIFileInit(void) {
|
||||
FIXME("(),stub!\n");
|
||||
}
|
||||
|
||||
typedef struct IAVIFileImpl {
|
||||
/* IUnknown stuff */
|
||||
ICOM_VFIELD(IAVIFile);
|
||||
DWORD ref;
|
||||
/* IAVIFile stuff... */
|
||||
} IAVIFileImpl;
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
|
||||
ICOM_THIS(IAVIFileImpl,iface);
|
||||
|
||||
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
||||
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
|
||||
!memcmp(&IID_IAVIFile,refiid,sizeof(IID_IAVIFile))
|
||||
) {
|
||||
*obj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
return OLE_E_ENUM_NOMORE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
|
||||
ICOM_THIS(IAVIFileImpl,iface);
|
||||
|
||||
FIXME("(%p)->AddRef()\n",iface);
|
||||
return ++(This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
|
||||
ICOM_THIS(IAVIFileImpl,iface);
|
||||
|
||||
FIXME("(%p)->Release()\n",iface);
|
||||
if (!--(This->ref)) {
|
||||
HeapFree(GetProcessHeap(),0,iface);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) {
|
||||
FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);
|
||||
|
||||
/* FIXME: fill out struct? */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
|
||||
FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);
|
||||
/* FIXME: create interface etc. */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
|
||||
ICOM_THIS(IAVIStreamImpl,iface);
|
||||
char fcc[5];
|
||||
IAVIStreamImpl *istream;
|
||||
|
||||
FIXME("(%p,%p,%p)\n",This,avis,asi);
|
||||
istream = (IAVIStreamImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIStreamImpl));
|
||||
istream->ref = 1;
|
||||
ICOM_VTBL(istream) = &iavist;
|
||||
fcc[4]='\0';
|
||||
memcpy(fcc,(char*)&(asi->fccType),4);
|
||||
FIXME("\tfccType '%s'\n",fcc);
|
||||
memcpy(fcc,(char*)&(asi->fccHandler),4);
|
||||
FIXME("\tfccHandler '%s'\n",fcc);
|
||||
FIXME("\tdwFlags 0x%08lx\n",asi->dwFlags);
|
||||
FIXME("\tdwCaps 0x%08lx\n",asi->dwCaps);
|
||||
FIXME("\tname '%s'\n",debugstr_w(asi->szName));
|
||||
|
||||
istream->curframe = 0;
|
||||
*avis = (PAVISTREAM)istream;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size) {
|
||||
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,ckid,lpData,size);
|
||||
/* FIXME: write data to file */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size) {
|
||||
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,ckid,lpData,size);
|
||||
/* FIXME: read at most size bytes from file */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) {
|
||||
FIXME("(%p)->EndRecord()\n",iface);
|
||||
/* FIXME: end record? */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam) {
|
||||
FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",iface,fccType,lParam);
|
||||
/* FIXME: delete stream? */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileOpenA
|
||||
*/
|
||||
HRESULT WINAPI AVIFileOpenA(
|
||||
PAVIFILE * ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler
|
||||
) {
|
||||
IAVIFileImpl *iavi;
|
||||
|
||||
FIXME("(%p,%s,0x%08lx,%s),stub!\n",ppfile,szFile,(DWORD)uMode,debugstr_guid(lpHandler));
|
||||
iavi = (IAVIFileImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIFileImpl));
|
||||
iavi->ref = 1;
|
||||
ICOM_VTBL(iavi) = &iavift;
|
||||
*ppfile = (LPVOID)iavi;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
|
||||
ICOM_THIS(IAVIStreamImpl,iface);
|
||||
|
||||
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
|
||||
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
|
||||
!memcmp(&IID_IAVIStream,refiid,sizeof(IID_IAVIStream))
|
||||
) {
|
||||
*obj = This;
|
||||
return S_OK;
|
||||
}
|
||||
/* can return IGetFrame interface too */
|
||||
return OLE_E_ENUM_NOMORE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
|
||||
ICOM_THIS(IAVIStreamImpl,iface);
|
||||
|
||||
FIXME("(%p)->AddRef()\n",iface);
|
||||
return ++(This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
|
||||
ICOM_THIS(IAVIStreamImpl,iface);
|
||||
|
||||
FIXME("(%p)->Release()\n",iface);
|
||||
if (!--(This->ref)) {
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2) {
|
||||
FIXME("(%p)->Create(0x%08lx,0x%08lx)\n",iface,lParam1,lParam2);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size) {
|
||||
FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags) {
|
||||
FIXME("(%p)->FindSample(%ld,0x%08lx)\n",iface,pos,flags);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) {
|
||||
FIXME("(%p)->ReadFormat(%ld,%p,%p)\n",iface,pos,format,formatsize);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* IAVIStream::SetFormat
|
||||
*/
|
||||
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
|
||||
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
|
||||
|
||||
FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",iface,pos,format,formatsize);
|
||||
if (as->lpInputFormat) HeapFree(GetProcessHeap(),0,as->lpInputFormat);
|
||||
as->inputformatsize = formatsize;
|
||||
as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize);
|
||||
memcpy(as->lpInputFormat,format,formatsize);
|
||||
if (as->iscompressing) {
|
||||
int xsize;
|
||||
/* Set up the Compressor part */
|
||||
xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat);
|
||||
as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize);
|
||||
ICCompressGetFormat(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
||||
ICCompressBegin(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
||||
as->compbufsize = ICCompressGetSize(as->hic,as->lpInputFormat,as->lpCompressFormat);
|
||||
as->compbuffer = HeapAlloc(GetProcessHeap(),0,as->compbufsize);
|
||||
|
||||
/* Set up the Decompressor part (for prev frames?) */
|
||||
xsize=ICDecompressGetFormatSize(as->hic,as->lpCompressFormat);
|
||||
as->decompformat = HeapAlloc(GetProcessHeap(),0,xsize);
|
||||
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
|
||||
as->decompbufsize=((LPBITMAPINFOHEADER)as->decompbuffer)->biSizeImage;
|
||||
as->decompbuffer = HeapReAlloc(GetProcessHeap(),0,as->decompbuffer,as->decompbufsize);
|
||||
memset(as->decompbuffer,0xff,as->decompbufsize);
|
||||
assert(HeapValidate(GetProcessHeap(),0,NULL));
|
||||
|
||||
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
|
||||
ICDecompressBegin(as->hic,as->lpCompressFormat,as->decompformat);
|
||||
as->lpPrev = as->lpPrevFormat = NULL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
|
||||
FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",iface,start,samples,buffer,buffersize,bytesread,samplesread);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
|
||||
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
|
||||
DWORD ckid,xflags;
|
||||
|
||||
FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
|
||||
|
||||
ICCompress(
|
||||
as->hic,flags,
|
||||
as->lpCompressFormat,
|
||||
as->compbuffer,
|
||||
as->lpInputFormat,buffer,
|
||||
&ckid,&xflags,
|
||||
as->curframe,0xffffff/*framesize*/,as->aco.dwQuality,
|
||||
as->lpPrevFormat,as->lpPrev
|
||||
);
|
||||
ICDecompress(
|
||||
as->hic,
|
||||
flags, /* FIXME: check */
|
||||
as->lpCompressFormat,
|
||||
as->compbuffer,
|
||||
as->decompformat,
|
||||
as->decompbuffer
|
||||
);
|
||||
/* We now have a prev format for the next compress ... */
|
||||
as->lpPrevFormat = as->decompformat;
|
||||
as->lpPrev = as->decompbuffer;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) {
|
||||
FIXME("(%p)->Delete(%ld,%ld)\n",iface,start,samples);
|
||||
return E_FAIL;
|
||||
}
|
||||
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) {
|
||||
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,fcc,lp,lpread);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) {
|
||||
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,fcc,lp,size);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) {
|
||||
FIXME("(%p)->SetInfo(%p,%ld)\n",iface,info,infolen);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileCreateStreamA
|
||||
*/
|
||||
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
|
||||
AVISTREAMINFOW psiw;
|
||||
|
||||
/* Only the szName at the end is different */
|
||||
memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
|
||||
MultiByteToWideChar( CP_ACP, 0, psi->szName, -1,
|
||||
psiw.szName, sizeof(psiw.szName) / sizeof(WCHAR) );
|
||||
return IAVIFile_CreateStream(iface,ppavi,&psiw);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileCreateStreamW
|
||||
*/
|
||||
HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
|
||||
return IAVIFile_CreateStream(iface,avis,asi);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileGetStream
|
||||
*/
|
||||
HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
|
||||
return IAVIFile_GetStream(iface,avis,fccType,lParam);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileInfoA
|
||||
*/
|
||||
HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
|
||||
AVIFILEINFOW afiw;
|
||||
HRESULT hres;
|
||||
|
||||
if (size < sizeof(AVIFILEINFOA))
|
||||
return AVIERR_BADSIZE;
|
||||
hres = IAVIFile_Info(iface,&afiw,sizeof(afiw));
|
||||
memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType));
|
||||
WideCharToMultiByte( CP_ACP, 0, afiw.szFileType, -1,
|
||||
afi->szFileType, sizeof(afi->szFileType), NULL, NULL );
|
||||
afi->szFileType[sizeof(afi->szFileType)-1] = 0;
|
||||
return hres;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamInfoW
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
|
||||
size) {
|
||||
return IAVIFile_Info(iface,asi,size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamInfoA
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
|
||||
size) {
|
||||
AVISTREAMINFOW asiw;
|
||||
HRESULT hres;
|
||||
|
||||
if (size<sizeof(AVISTREAMINFOA))
|
||||
return AVIERR_BADSIZE;
|
||||
hres = IAVIFile_Info(iface,&asiw,sizeof(asiw));
|
||||
memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName));
|
||||
WideCharToMultiByte( CP_ACP, 0, asiw.szName, -1,
|
||||
asi->szName, sizeof(asi->szName), NULL, NULL );
|
||||
asi->szName[sizeof(asi->szName)-1] = 0;
|
||||
return hres;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileInfoW
|
||||
*/
|
||||
HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
|
||||
return IAVIFile_Info(iface,afi,size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIMakeCompressedStream
|
||||
*/
|
||||
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
|
||||
char fcc[5];
|
||||
IAVIStreamImpl *as;
|
||||
FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
|
||||
fcc[4]='\0';
|
||||
memcpy(fcc,&(aco->fccType),4);
|
||||
FIXME("\tfccType: '%s'\n",fcc);
|
||||
memcpy(fcc,&(aco->fccHandler),4);
|
||||
FIXME("\tfccHandler: '%s'\n",fcc);
|
||||
FIXME("\tdwFlags: 0x%08lx\n",aco->dwFlags);
|
||||
|
||||
/* we just create a duplicate for now */
|
||||
IAVIStream_AddRef(ppsSource);
|
||||
*ppsCompressed = ppsSource;
|
||||
as = (IAVIStreamImpl*)ppsSource;
|
||||
|
||||
/* this is where the fun begins. Open a compressor and prepare it. */
|
||||
as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
|
||||
|
||||
/* May happen. for instance if the codec is not able to compress */
|
||||
if (!as->hic)
|
||||
return AVIERR_UNSUPPORTED;
|
||||
|
||||
ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));
|
||||
FIXME("Opened compressor: '%s' '%s'\n",debugstr_w(as->icinfo.szName),debugstr_w(as->icinfo.szDescription));
|
||||
as->iscompressing = TRUE;
|
||||
memcpy(&(as->aco),aco,sizeof(*aco));
|
||||
if (as->icinfo.dwFlags & VIDCF_COMPRESSFRAMES) {
|
||||
ICCOMPRESSFRAMES icf;
|
||||
|
||||
/* now what to fill in there ... Hmm */
|
||||
memset(&icf,0,sizeof(icf));
|
||||
icf.lDataRate = aco->dwBytesPerSecond;
|
||||
icf.lQuality = aco->dwQuality;
|
||||
icf.lKeyRate = aco->dwKeyFrameEvery;
|
||||
|
||||
icf.GetData = (void *)0xdead4242;
|
||||
icf.PutData = (void *)0xdead4243;
|
||||
ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamSetFormat
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
|
||||
return IAVIStream_SetFormat(iface,pos,format,formatsize);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamReadFormat
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
|
||||
return IAVIStream_ReadFormat(iface,pos,format,formatsize);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamWrite(
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
|
||||
return IAVIStream_Write(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamRead
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
|
||||
return IAVIStream_Read(iface,start,samples,buffer,buffersize,bytesread,samplesread);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamWriteData
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
|
||||
return IAVIStream_WriteData(iface,fcc,lp,size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamReadData
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
|
||||
return IAVIStream_ReadData(iface,fcc,lp,lpread);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamStart
|
||||
*/
|
||||
LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
|
||||
AVISTREAMINFOW si;
|
||||
|
||||
IAVIStream_Info(iface,&si,sizeof(si));
|
||||
return si.dwStart;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamLength
|
||||
*/
|
||||
LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
|
||||
AVISTREAMINFOW si;
|
||||
HRESULT ret;
|
||||
|
||||
ret = IAVIStream_Info(iface,&si,sizeof(si));
|
||||
if (ret) /* error */
|
||||
return 1;
|
||||
return si.dwLength;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamRelease
|
||||
*/
|
||||
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
|
||||
return IAVIStream_Release(iface);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamGetFrameOpen
|
||||
*/
|
||||
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
|
||||
FIXME("(%p)->(%p),stub!\n",iface,bmi);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamGetFrame
|
||||
*/
|
||||
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
|
||||
return IGetFrame_GetFrame(pg,pos);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamGetFrameClose
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
|
||||
if (pg) IGetFrame_Release(pg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileRelease
|
||||
*/
|
||||
ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
|
||||
return IAVIFile_Release(iface);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileExit
|
||||
*/
|
||||
void WINAPI AVIFileExit(void) {
|
||||
FIXME("(), stub.\n");
|
||||
}
|
545
tags/gpgme-1.1.5/complus/gpgcom.c
Normal file
545
tags/gpgme-1.1.5/complus/gpgcom.c
Normal file
@ -0,0 +1,545 @@
|
||||
/* gpgcom.c - COM+ component to access GnuPG
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <ole2.h>
|
||||
|
||||
#include "argparse.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "igpgme.h"
|
||||
|
||||
static void register_server (void);
|
||||
static void unregister_server (void);
|
||||
static void enter_complus (void);
|
||||
|
||||
|
||||
enum cmd_and_opt_values { aNull = 0,
|
||||
oQuiet = 'q',
|
||||
oVerbose = 'v',
|
||||
|
||||
oNoVerbose = 500,
|
||||
oOptions,
|
||||
oDebug,
|
||||
oDebugAll,
|
||||
oNoGreeting,
|
||||
oNoOptions,
|
||||
oHomedir,
|
||||
oGPGBinary,
|
||||
oRegServer,
|
||||
oUnregServer,
|
||||
oEmbedding,
|
||||
aTest };
|
||||
|
||||
|
||||
static ARGPARSE_OPTS opts[] = {
|
||||
|
||||
{ 301, NULL, 0, N_("@Options:\n ") },
|
||||
|
||||
{ oVerbose, "verbose", 0, N_("verbose") },
|
||||
{ oQuiet, "quiet", 0, N_("be somewhat more quiet") },
|
||||
{ oOptions, "options" , 2, N_("read options from file")},
|
||||
{ oDebug, "debug" ,4|16, N_("set debugging flags")},
|
||||
{ oDebugAll, "debug-all" ,0, N_("enable full debugging")},
|
||||
{ oGPGBinary, "gpg-program", 2 , "" },
|
||||
{ oRegServer, "RegServer" , 0, "" },
|
||||
{ oUnregServer, "UnregServer" , 0, "" },
|
||||
{ oEmbedding, "Embedding" , 0, "" },
|
||||
{0} };
|
||||
|
||||
|
||||
|
||||
|
||||
static const char *
|
||||
my_strusage( int level )
|
||||
{
|
||||
const char *p;
|
||||
switch( level ) {
|
||||
case 11: p = "gpgcom";
|
||||
break;
|
||||
case 13: p = VERSION; break;
|
||||
/*case 17: p = PRINTABLE_OS_NAME; break;*/
|
||||
case 19: p =
|
||||
_("Please report bugs to <gpgme-bugs@gnupg.org>.\n");
|
||||
break;
|
||||
case 1:
|
||||
case 40: p =
|
||||
_("Usage: gpgcom [options] (-h for help)");
|
||||
break;
|
||||
case 41: p =
|
||||
_("Syntax: gpgcom [options]\n"
|
||||
"GnuPG COM+ component\n");
|
||||
break;
|
||||
|
||||
default: p = NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv )
|
||||
{
|
||||
ARGPARSE_ARGS pargs;
|
||||
int orig_argc;
|
||||
char **orig_argv;
|
||||
FILE *configfp = NULL;
|
||||
char *configname = NULL;
|
||||
unsigned configlineno;
|
||||
int parse_debug = 0;
|
||||
int default_config =1;
|
||||
int greeting = 0;
|
||||
int nogreeting = 0;
|
||||
int action = 0;
|
||||
|
||||
set_strusage( my_strusage );
|
||||
/*log_set_name ("gpa"); not yet implemented in logging.c */
|
||||
|
||||
opt.homedir = getenv("GNUPGHOME");
|
||||
if( !opt.homedir || !*opt.homedir ) {
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
opt.homedir = "c:/gnupg";
|
||||
#else
|
||||
opt.homedir = "~/.gnupg";
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check whether we have a config file on the commandline */
|
||||
orig_argc = argc;
|
||||
orig_argv = argv;
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags= 1|(1<<6); /* do not remove the args, ignore version */
|
||||
while( arg_parse( &pargs, opts) ) {
|
||||
if( pargs.r_opt == oDebug || pargs.r_opt == oDebugAll )
|
||||
parse_debug++;
|
||||
else if( pargs.r_opt == oOptions ) {
|
||||
/* yes there is one, so we do not try the default one, but
|
||||
* read the option file when it is encountered at the commandline
|
||||
*/
|
||||
default_config = 0;
|
||||
}
|
||||
else if( pargs.r_opt == oNoOptions )
|
||||
default_config = 0; /* --no-options */
|
||||
else if( pargs.r_opt == oHomedir )
|
||||
opt.homedir = pargs.r.ret_str;
|
||||
}
|
||||
|
||||
if( default_config )
|
||||
configname = make_filename(opt.homedir, "gpgme.conf", NULL );
|
||||
|
||||
|
||||
argc = orig_argc;
|
||||
argv = orig_argv;
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags= 1 | (1<<5); /* do not remove the args, allow one dash */
|
||||
next_pass:
|
||||
if( configname ) {
|
||||
configlineno = 0;
|
||||
configfp = fopen( configname, "r" );
|
||||
if( !configfp ) {
|
||||
if( default_config ) {
|
||||
if( parse_debug )
|
||||
log_info(_("NOTE: no default option file `%s'\n"),
|
||||
configname );
|
||||
}
|
||||
else {
|
||||
log_error(_("option file `%s': %s\n"),
|
||||
configname, strerror(errno) );
|
||||
exit(2);
|
||||
}
|
||||
free(configname); configname = NULL;
|
||||
}
|
||||
if( parse_debug && configname )
|
||||
log_info(_("reading options from `%s'\n"), configname );
|
||||
default_config = 0;
|
||||
}
|
||||
|
||||
while( optfile_parse( configfp, configname, &configlineno,
|
||||
&pargs, opts) ) {
|
||||
switch( pargs.r_opt ) {
|
||||
case oQuiet: opt.quiet = 1; break;
|
||||
case oVerbose: opt.verbose++; break;
|
||||
|
||||
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
|
||||
case oDebugAll: opt.debug = ~0; break;
|
||||
|
||||
case oOptions:
|
||||
/* config files may not be nested (silently ignore them) */
|
||||
if( !configfp ) {
|
||||
free(configname);
|
||||
configname = xstrdup(pargs.r.ret_str);
|
||||
goto next_pass;
|
||||
}
|
||||
break;
|
||||
case oNoGreeting: nogreeting = 1; break;
|
||||
case oNoVerbose: opt.verbose = 0; break;
|
||||
case oNoOptions: break; /* no-options */
|
||||
case oHomedir: opt.homedir = pargs.r.ret_str; break;
|
||||
case oGPGBinary: break;
|
||||
|
||||
case oRegServer: action = 1; break;
|
||||
case oUnregServer: action = 2; break;
|
||||
case oEmbedding: action = 3; break;
|
||||
|
||||
default : pargs.err = configfp? 1:2; break;
|
||||
}
|
||||
}
|
||||
if( configfp ) {
|
||||
fclose( configfp );
|
||||
configfp = NULL;
|
||||
free(configname); configname = NULL;
|
||||
goto next_pass;
|
||||
}
|
||||
free( configname ); configname = NULL;
|
||||
if( log_get_errorcount(0) )
|
||||
exit(2);
|
||||
if( nogreeting )
|
||||
greeting = 0;
|
||||
|
||||
if( greeting ) {
|
||||
fprintf(stderr, "%s %s; %s\n",
|
||||
strusage(11), strusage(13), strusage(14) );
|
||||
fprintf(stderr, "%s\n", strusage(15) );
|
||||
}
|
||||
#ifdef IS_DEVELOPMENT_VERSION
|
||||
log_info("NOTE: this is a development version!\n");
|
||||
#endif
|
||||
|
||||
if ( action == 1 )
|
||||
register_server ();
|
||||
else if (action == 2 )
|
||||
unregister_server ();
|
||||
else if (action == 3 )
|
||||
enter_complus ();
|
||||
else {
|
||||
fprintf (stderr, "This is a COM+ component with no user interface.\n"
|
||||
"gpgme --help will give you a list of options\n" );
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
register_progid ( const char *name )
|
||||
{
|
||||
HKEY hk = 0;
|
||||
char buf[500];
|
||||
|
||||
/* Create a ProgID entry to point to the ClassID */
|
||||
sprintf (buf, "%.400s", name);
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
sprintf (buf, "g10 Code's GnuPG made easy COMponent" );
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, buf, 0)) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
sprintf (buf, "%.400s\\CLSID", name);
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
sprintf (buf, "%.100s", debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, buf, strlen (buf))) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
register_typelib (void)
|
||||
{
|
||||
ITypeLib *pTypeLib;
|
||||
HRESULT hr;
|
||||
char name[500];
|
||||
wchar_t *wname;
|
||||
size_t n;
|
||||
|
||||
if ( !GetModuleFileNameA (0, name, sizeof (name)-10) ) {
|
||||
fprintf (stderr,"GetModuleFileName() failed: %d\n",
|
||||
(int)GetLastError());
|
||||
exit (1);
|
||||
}
|
||||
n = mbstowcs (NULL, name, strlen(name)+1);
|
||||
wname = xmalloc ((n+1)*sizeof *wname);
|
||||
mbstowcs (wname, name, strlen (name)+1);
|
||||
|
||||
hr = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
|
||||
if (hr)
|
||||
fprintf (stderr, "CoInitializeEx() failed: hr=%lu\n", hr);
|
||||
|
||||
hr = LoadTypeLibEx (wname, REGKIND_REGISTER, &pTypeLib);
|
||||
if (hr)
|
||||
fprintf (stderr, "LoadTypeLibEx() failed: hr=%lx\n", hr);
|
||||
|
||||
ITypeLib_Release (pTypeLib);
|
||||
CoUninitialize ();
|
||||
free (wname);
|
||||
}
|
||||
|
||||
static void
|
||||
unregister_typelib (void)
|
||||
{
|
||||
UnRegisterTypeLib (&TLBID_Gpgcom, 1, 0, LANG_NEUTRAL, SYS_WIN32);
|
||||
}
|
||||
|
||||
static void
|
||||
register_server ()
|
||||
{
|
||||
HKEY hk = 0;
|
||||
char buf[500];
|
||||
|
||||
|
||||
register_typelib ();
|
||||
|
||||
/* Create a key for the CLSID */
|
||||
sprintf (buf, "CLSID\\%.100s", debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
/* Store our class name as default value */
|
||||
strcpy (buf, "Gpgme");
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, buf, strlen (buf))) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Set the application ID */
|
||||
sprintf (buf, "%.100s", debugstr_guid (&APPID_Gpgcom) );
|
||||
if (RegSetValueExA (hk, "AppID", 0, REG_SZ, buf, strlen (buf))) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
|
||||
/* Create the LocalServer32 subkey under the CLSID key */
|
||||
sprintf (buf, "CLSID\\%.100s\\LocalServer32",
|
||||
debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
/* retrieve the module name and add it under the key */
|
||||
if ( !GetModuleFileNameA (0, buf, sizeof (buf)-10) ) {
|
||||
fprintf (stderr,"GetModuleFileName() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, buf, strlen (buf))) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
|
||||
/* Create the ProgID subkey under the CLSID key */
|
||||
sprintf (buf, "CLSID\\%.100s\\ProgID",
|
||||
debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, "Gpgcom.Gpgme.1", 0)) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
/* Create the VersionIndependentProgID subkey under the CLSID key */
|
||||
sprintf (buf, "CLSID\\%.100s\\VersionIndependentProgID",
|
||||
debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, "Gpgcom.Gpgme", 0)) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
|
||||
|
||||
/* Create a key to store AppID info */
|
||||
sprintf (buf, "AppID\\%.100s", debugstr_guid (&APPID_Gpgcom) );
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
/* Store the name as default value */
|
||||
strcpy (buf, "Gpgcom");
|
||||
if (RegSetValueExA (hk, 0, 0, REG_SZ, buf, strlen (buf))) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
|
||||
register_progid ("Gpgcom.Gpgme");
|
||||
register_progid ("Gpgcom.Gpgme.1");
|
||||
|
||||
/* Create a convenience cross reference to the AppID */
|
||||
sprintf (buf, "AppID\\gpgcom.exe");
|
||||
if (RegCreateKeyA (HKEY_CLASSES_ROOT, buf, &hk)) {
|
||||
fprintf (stderr,"RegCreateKey(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
sprintf (buf, "%.100s", debugstr_guid (&APPID_Gpgcom) );
|
||||
if (RegSetValueExA (hk, "AppID", 0, REG_SZ, buf, strlen (buf))) {
|
||||
fprintf (stderr,"RegSetValueEx(`%s') failed\n", buf);
|
||||
exit (1);
|
||||
}
|
||||
if (RegCloseKey (hk)) {
|
||||
fprintf (stderr,"RegCloseKey() failed\n");
|
||||
exit (1);
|
||||
}
|
||||
hk = 0;
|
||||
|
||||
fprintf (stderr,"*** Component registered\n");
|
||||
}
|
||||
|
||||
static void
|
||||
unregister_server ()
|
||||
{
|
||||
char buf[500];
|
||||
|
||||
unregister_typelib ();
|
||||
sprintf (buf, "CLSID\\%.100s\\LocalServer32",
|
||||
debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
sprintf (buf, "CLSID\\%.100s\\ProgID", debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
sprintf (buf, "CLSID\\%.100s", debugstr_guid (&CLSID_Gpgme) );
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
sprintf (buf, "Gpgcom.Gpgme.1\\CLSID");
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
sprintf (buf, "Gpgcom.Gpgme.1");
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
sprintf (buf, "Gpgcom.Gpgme\\CLSID");
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
sprintf (buf, "Gpgcom.Gpgme");
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
|
||||
sprintf (buf, "AppID\\%.100s", debugstr_guid (&APPID_Gpgcom) );
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
sprintf (buf, "AppID\\gpgcom.exe" );
|
||||
if (RegDeleteKey (HKEY_CLASSES_ROOT, buf))
|
||||
fprintf (stderr,"RegDeleteKey(`%s') failed\n", buf);
|
||||
|
||||
fprintf (stderr,"*** component unregistered\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
enter_complus ()
|
||||
{
|
||||
HANDLE running;
|
||||
DWORD reg;
|
||||
IClassFactory *factory;
|
||||
CLSID clsid;
|
||||
HRESULT hr;
|
||||
|
||||
fprintf (stderr,"*** enter enter_complus()\n");
|
||||
CoInitializeEx (NULL, COINIT_MULTITHREADED);
|
||||
running = CreateEvent (NULL, FALSE, FALSE, NULL );
|
||||
fprintf (stderr,"*** CoInitialize() done; event=%lx\n", (unsigned long)running );
|
||||
|
||||
igpgme_register_exit_event (running);
|
||||
factory = igpgme_factory_new ( &clsid );
|
||||
fprintf (stderr,"*** igpgme_factory_new() done; got=%p\n", factory );
|
||||
hr = CoRegisterClassObject (&clsid, (IUnknown*)factory,
|
||||
CLSCTX_LOCAL_SERVER,
|
||||
REGCLS_SUSPENDED|REGCLS_MULTIPLEUSE, ® );
|
||||
if (hr) {
|
||||
fprintf (stderr, "CoRegisterClassObject() failed: hr=%lx\n", hr);
|
||||
exit (1);
|
||||
}
|
||||
hr = CoResumeClassObjects ();
|
||||
if (hr)
|
||||
fprintf (stderr, "CoRegisterClassObject() failed: hr=%lx\n", hr);
|
||||
fprintf (stderr,"*** class object registered; waiting\n" );
|
||||
|
||||
WaitForSingleObject ( running, INFINITE );
|
||||
fprintf (stderr,"*** shutting down\n" );
|
||||
igpgme_register_exit_event (NULL);
|
||||
CloseHandle (running);
|
||||
CoRevokeClassObject ( reg );
|
||||
fprintf (stderr,"*** class object revoked\n" );
|
||||
igpgme_factory_release (factory);
|
||||
fprintf (stderr,"*** factory released\n" );
|
||||
CoUninitialize ();
|
||||
fprintf (stderr,"*** leave enter_complus()\n" );
|
||||
}
|
||||
|
62
tags/gpgme-1.1.5/complus/gpgcom.idl
Normal file
62
tags/gpgme-1.1.5/complus/gpgcom.idl
Normal file
@ -0,0 +1,62 @@
|
||||
/* ignupg.idl - Interface definition for the COM+ class GnuPG
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
|
||||
import "unknwn.idl";
|
||||
import "oaidl.idl";
|
||||
|
||||
|
||||
[ object, uuid(3811fd50-7f72-11d5-8c9e-0080ad190cd5), dual]
|
||||
interface IGpgme : IDispatch
|
||||
{
|
||||
HRESULT GetVersion([out] BSTR *retval);
|
||||
HRESULT GetEngineInfo([out] BSTR *retval);
|
||||
HRESULT Cancel(void);
|
||||
[propput] HRESULT Armor([in] BOOL flag);
|
||||
[propget] HRESULT Armor([out, retval] BOOL *retval);
|
||||
[propput] HRESULT Textmode([in] BOOL flag);
|
||||
[propget] HRESULT Textmode([out, retval] BOOL *retval);
|
||||
[propput] HRESULT Plaintext([in] VARIANT val);
|
||||
[propget] HRESULT Plaintext([out, retval] VARIANT *retval);
|
||||
[propput] HRESULT Ciphertext([in] VARIANT val);
|
||||
[propget] HRESULT Ciphertext([out,retval] VARIANT *retval);
|
||||
HRESULT ClearRecipients(void);
|
||||
HRESULT AddRecipient([in] BSTR name,
|
||||
[in, optional, defaultvalue(-1)] signed short trust);
|
||||
HRESULT ResetSignKeys(void);
|
||||
HRESULT AddSignKey([in] BSTR name);
|
||||
HRESULT Encrypt(void);
|
||||
HRESULT Sign([in,optional,defaultvalue(0)] signed short signmode);
|
||||
HRESULT SignEncrypt([in,optional,defaultvalue(0)] signed short signmode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
[ uuid(3811fd48-7f72-11d5-8c9e-0080ad190cd5),
|
||||
helpstring("g10Code.gpgcom, type library"),
|
||||
version(1.0) ]
|
||||
library GpgcomLib
|
||||
{
|
||||
[ uuid(3811fd40-7f72-11d5-8c9e-0080ad190cd5) ]
|
||||
coclass Gpgcom
|
||||
{
|
||||
[default] interface IGpgme;
|
||||
}
|
||||
};
|
22
tags/gpgme-1.1.5/complus/gpgcom.rc
Normal file
22
tags/gpgme-1.1.5/complus/gpgcom.rc
Normal file
@ -0,0 +1,22 @@
|
||||
/* gpgcom.rc - Resource file for gpgcom
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
1 TYPELIB "gpgcom.tlb"
|
||||
|
BIN
tags/gpgme-1.1.5/complus/gpgcom.tlb
Normal file
BIN
tags/gpgme-1.1.5/complus/gpgcom.tlb
Normal file
Binary file not shown.
130
tags/gpgme-1.1.5/complus/guidgen.c
Normal file
130
tags/gpgme-1.1.5/complus/guidgen.c
Normal file
@ -0,0 +1,130 @@
|
||||
/* guidgen.c - Tool to create GUIDs
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "obj_base.h"
|
||||
|
||||
#include "argparse.h"
|
||||
|
||||
|
||||
enum cmd_and_opt_values { aNull = 0,
|
||||
oVerbose = 'v',
|
||||
|
||||
aTest };
|
||||
|
||||
|
||||
static ARGPARSE_OPTS opts[] = {
|
||||
|
||||
{ 301, NULL, 0, "@Options:\n " },
|
||||
|
||||
{ oVerbose, "verbose", 0, "verbose" },
|
||||
{0} };
|
||||
|
||||
static struct {
|
||||
int verbose;
|
||||
} opt;
|
||||
|
||||
|
||||
static void create_guid (void);
|
||||
|
||||
static const char *
|
||||
my_strusage( int level )
|
||||
{
|
||||
const char *p;
|
||||
switch( level ) {
|
||||
case 11: p = "guidgen";
|
||||
break;
|
||||
case 13: p = VERSION; break;
|
||||
/*case 17: p = PRINTABLE_OS_NAME; break;*/
|
||||
case 19: p =
|
||||
"Please report bugs to <gpgme-bugs@gnupg.org>.\n";
|
||||
break;
|
||||
case 1:
|
||||
case 40: p =
|
||||
"Usage: guidgen [options] (-h for help)";
|
||||
break;
|
||||
case 41: p =
|
||||
"Syntax: guidgen [options]\n"
|
||||
"Generate GUIDs\n";
|
||||
break;
|
||||
|
||||
default: p = NULL;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv )
|
||||
{
|
||||
ARGPARSE_ARGS pargs;
|
||||
|
||||
set_strusage( my_strusage );
|
||||
/*log_set_name ("gpa"); not yet implemented in logging.c */
|
||||
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags= 0;
|
||||
while( arg_parse( &pargs, opts) ) {
|
||||
switch( pargs.r_opt ) {
|
||||
case oVerbose: opt.verbose++; break;
|
||||
|
||||
default : pargs.err = 2; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!argc)
|
||||
create_guid();
|
||||
else {
|
||||
int n;
|
||||
|
||||
for (n = atoi (argv[0]); n > 0; n-- )
|
||||
create_guid ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
create_guid ()
|
||||
{
|
||||
GUID guid, *id;
|
||||
id = &guid;
|
||||
if ( CoCreateGuid (id) ) {
|
||||
fprintf (stderr,"failed to create GUID\n");
|
||||
exit (1);
|
||||
}
|
||||
printf( "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
|
||||
id->Data1, id->Data2, id->Data3,
|
||||
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
|
||||
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
|
||||
}
|
||||
|
||||
|
859
tags/gpgme-1.1.5/complus/igpgme.c
Normal file
859
tags/gpgme-1.1.5/complus/igpgme.c
Normal file
@ -0,0 +1,859 @@
|
||||
/* igpgme.c - COM+ class IGpgme
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "../gpgme/gpgme.h"
|
||||
|
||||
/* FIXME: Put them into an extra header */
|
||||
void *_gpgme_malloc (size_t n );
|
||||
void *_gpgme_calloc (size_t n, size_t m );
|
||||
void *_gpgme_realloc (void *p, size_t n);
|
||||
char *_gpgme_strdup (const char *p);
|
||||
void _gpgme_free ( void *a );
|
||||
|
||||
|
||||
|
||||
#define INITGUID
|
||||
#include "igpgme.h"
|
||||
|
||||
/*
|
||||
* Declare the interface implementation structures
|
||||
*/
|
||||
typedef struct IGpgmeImpl IGpgmeImpl;
|
||||
typedef struct IClassFactoryImpl IClassFactoryImpl;
|
||||
|
||||
static HANDLE my_exit_event;
|
||||
|
||||
struct IGpgmeImpl {
|
||||
/* IUnknown required stuff */
|
||||
ICOM_VFIELD (IGpgme);
|
||||
DWORD ref;
|
||||
/* Delegation to IDispatch */
|
||||
struct {
|
||||
IUnknown *disp;
|
||||
ITypeInfo *tinfo;
|
||||
} std_disp;
|
||||
/* Our stuff */
|
||||
GpgmeCtx mainctx;
|
||||
GpgmeData plaintext;
|
||||
int plaintext_given_as_bstr;
|
||||
GpgmeData ciphertext;
|
||||
int ciphertext_is_armored;
|
||||
GpgmeRecipients rset;
|
||||
};
|
||||
|
||||
|
||||
struct IClassFactoryImpl {
|
||||
/* IUnknown fields */
|
||||
ICOM_VFIELD(IClassFactory);
|
||||
DWORD ref;
|
||||
};
|
||||
|
||||
/**********************************************************
|
||||
************** helper functions ************************
|
||||
*********************************************************/
|
||||
static HRESULT
|
||||
map_gpgme_error (GpgmeError err)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (!err)
|
||||
return 0;
|
||||
if ( err < 0 || err > 0x1000 ) {
|
||||
fprintf (stderr,"*** GpgmeError `%s' mapped to GPGME_General_Error\n",
|
||||
gpgme_strerror (err) );
|
||||
err = GPGME_General_Error;
|
||||
}
|
||||
hr = MAKE_HRESULT (SEVERITY_ERROR, FACILITY_ITF, 0x1000 + err);
|
||||
fprintf (stderr,"*** GpgmeError `%s' mapped to %lx\n",
|
||||
gpgme_strerror (err), (unsigned long)hr );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************
|
||||
************** IGpgme Implementation *******************
|
||||
*********************************************************/
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_QueryInterface (IGpgme *iface, REFIID refiid, LPVOID *obj)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
/*fprintf (stderr,"*** m_IGpgme_QueryInterface(%p,%s)",
|
||||
This, debugstr_guid(refiid));*/
|
||||
if ( IsEqualGUID (&IID_IUnknown, refiid)
|
||||
|| IsEqualGUID (&IID_IGpgme, refiid) ) {
|
||||
*obj = This;
|
||||
IGpgme_AddRef (iface);
|
||||
fprintf (stderr," -> got %p\n", *obj);
|
||||
return 0;
|
||||
}
|
||||
else if ( IsEqualGUID (&IID_IDispatch, refiid) ) {
|
||||
HRESULT hr = IDispatch_QueryInterface (This->std_disp.disp,
|
||||
refiid, obj);
|
||||
/*fprintf (stderr," -> delegated, hr=%lx, got %p\n",
|
||||
hr, hr? NULL: *obj);*/
|
||||
return hr;
|
||||
}
|
||||
/*fprintf (stderr," -> none\n");*/
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
static ULONG WINAPI
|
||||
m_IGpgme_AddRef (IGpgme *iface)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
return ++This->ref;
|
||||
}
|
||||
|
||||
|
||||
static ULONG WINAPI
|
||||
m_IGpgme_Release (IGpgme *iface)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
if (--This->ref)
|
||||
return This->ref;
|
||||
|
||||
gpgme_release (This->mainctx); This->mainctx = NULL;
|
||||
gpgme_data_release (This->plaintext); This->plaintext = NULL;
|
||||
gpgme_data_release (This->ciphertext); This->ciphertext = NULL;
|
||||
gpgme_recipients_release (This->rset); This->rset = NULL;
|
||||
if (This->std_disp.disp)
|
||||
IDispatch_Release (This->std_disp.disp);
|
||||
if (This->std_disp.tinfo)
|
||||
ITypeInfo_Release (This->std_disp.tinfo);
|
||||
HeapFree(GetProcessHeap(),0,iface);
|
||||
{
|
||||
ULONG count = CoReleaseServerProcess ();
|
||||
if (!count && my_exit_event)
|
||||
SetEvent (my_exit_event);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_stub_IDispatch_GetTypeInfoCount (IGpgme *iface, unsigned int *pctinfo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_stub_IDispatch_GetTypeInfo (IGpgme *iface, UINT iTInfo,
|
||||
LCID lcid, ITypeInfo **ppTInfo)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_stub_IDispatch_GetIDsOfNames (IGpgme *iface, REFIID riid,
|
||||
LPOLESTR *rgszNames, UINT cNames,
|
||||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_stub_IDispatch_Invoke (IGpgme *iface, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags,
|
||||
DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
||||
EXCEPINFO *pExepInfo, UINT *puArgErr)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetVersion (IGpgme *iface, BSTR *retvat)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetEngineInfo (IGpgme *iface, BSTR *retval)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_Cancel (IGpgme *iface)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_SetArmor (IGpgme *iface, BOOL yes)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
gpgme_set_armor (This->mainctx, yes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetArmor (IGpgme *iface, BOOL *retval)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
*retval = gpgme_get_armor (This->mainctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_SetTextmode (IGpgme *iface, BOOL yes)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
gpgme_set_textmode (This->mainctx, yes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetTextmode (IGpgme *iface, BOOL *retval)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
*retval = gpgme_get_textmode (This->mainctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Put the data from VAL into a a Gpgme data object, which is passed by
|
||||
* reference. Valid types of the Variant are: BSTR, SAFEARRAY of BYTE and
|
||||
* SAFEARRAY of VARIANTS of signed or unsigned integers.
|
||||
*/
|
||||
static HRESULT WINAPI
|
||||
set_data_from_variant (GpgmeData *data, VARIANT val, int *given_as_bstr)
|
||||
{
|
||||
GpgmeError err = 0;
|
||||
HRESULT hr;
|
||||
unsigned char *buf;
|
||||
SAFEARRAY *array;
|
||||
size_t len;
|
||||
int i;
|
||||
|
||||
if ( val.vt == VT_BSTR) {
|
||||
len = bstrtoutf8 (val.u.bstrVal, NULL, 0);
|
||||
buf = _gpgme_malloc (len);
|
||||
if (!buf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (bstrtoutf8 (val.u.bstrVal, buf, len) < 0) {
|
||||
fprintf (stderr,"problem with bstrtoutf8\n");
|
||||
_gpgme_free (buf);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
fprintf (stderr,"Got a BSTR (utf8):");
|
||||
for (i=0; i < len; i++)
|
||||
fprintf (stderr, " %0X", buf[i] );
|
||||
putc ('\n', stderr);
|
||||
#endif
|
||||
gpgme_data_release (*data); *data = NULL;
|
||||
err = gpgme_data_new_from_mem (data, buf, len, 0 /*no need to copy*/ );
|
||||
if (!err && given_as_bstr)
|
||||
*given_as_bstr = 1;
|
||||
}
|
||||
else if ( val.vt == (VT_ARRAY|VT_UI1)) {
|
||||
array = val.u.parray;
|
||||
|
||||
/*fprintf (stderr,"Got an ARRAY of bytes:");*/
|
||||
hr = SafeArrayAccessData (array, (void**)&buf);
|
||||
if (hr) {
|
||||
fprintf (stderr,"*** SafeArrayAccessData failed: hr=%lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
len = array->rgsabound[0].cElements;
|
||||
/*for (i=0; i < len; i++)
|
||||
fprintf (stderr, " %0X", buf[i] );
|
||||
putc ('\n', stderr);*/
|
||||
|
||||
gpgme_data_release (*data); *data = NULL;
|
||||
err = gpgme_data_new_from_mem (data, buf, len, 1 );
|
||||
SafeArrayUnaccessData (array);
|
||||
if (given_as_bstr)
|
||||
*given_as_bstr = 0;
|
||||
}
|
||||
else if ( val.vt == (VT_ARRAY|VT_VARIANT)) {
|
||||
VARIANT *vp;
|
||||
array = val.u.parray;
|
||||
|
||||
/*fprintf (stderr,"Got an ARRAY of VARIANTS:");*/
|
||||
hr = SafeArrayAccessData (array, (void**)&vp);
|
||||
if (hr) {
|
||||
fprintf (stderr,"*** SafeArrayAccessData failed: hr=%lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
len = array->rgsabound[0].cElements;
|
||||
/* allocate the array using the gpgme allocator so that we can
|
||||
* later use a new without the copy set*/
|
||||
buf = _gpgme_malloc (len);
|
||||
if (!buf) {
|
||||
SafeArrayUnaccessData (array);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
/* coerce all array elements into rawtext */
|
||||
for (i=0; i < len; i++) {
|
||||
switch (vp[i].vt) {
|
||||
case VT_I1: buf[i] = (BYTE)vp[i].u.cVal; break;
|
||||
case VT_I2: buf[i] = ((UINT)vp[i].u.iVal) & 0xff; break;
|
||||
case VT_I4: buf[i] = ((ULONG)vp[i].u.lVal) & 0xff; break;
|
||||
case VT_INT: buf[i] = ((UINT)vp[i].u.intVal) & 0xff; break;
|
||||
case VT_UI1: buf[i] = vp[i].u.bVal; break;
|
||||
case VT_UI2: buf[i] = vp[i].u.uiVal & 0xff; break;
|
||||
case VT_UI4: buf[i] = vp[i].u.ulVal & 0xff; break;
|
||||
case VT_UINT: buf[i] = vp[i].u.uintVal & 0xff; break;
|
||||
default:
|
||||
fprintf (stderr, "Invalid value in array as pos %d\n", i);
|
||||
_gpgme_free (buf);
|
||||
SafeArrayUnaccessData (array);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
/*for (i=0; i < len; i++)
|
||||
fprintf (stderr, " %0X", buf[i] );
|
||||
putc ('\n', stderr);*/
|
||||
|
||||
gpgme_data_release (*data); *data = NULL;
|
||||
err = gpgme_data_new_from_mem (data, buf, len, 0);
|
||||
SafeArrayUnaccessData (array);
|
||||
if (given_as_bstr)
|
||||
*given_as_bstr = 0;
|
||||
}
|
||||
else {
|
||||
fprintf (stderr, "Got a variant type = %d (0x%x)\n",
|
||||
(int)val.vt, (int)val.vt );
|
||||
return E_INVALIDARG; /* not a safearray of bytes */
|
||||
}
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
set_data_to_variant (GpgmeData data, VARIANT *retval, int use_bstr)
|
||||
{
|
||||
GpgmeError err;
|
||||
HRESULT hr;
|
||||
SAFEARRAY *array;
|
||||
char *p;
|
||||
size_t nread, len;
|
||||
int i;
|
||||
|
||||
/* Get some info on the data */
|
||||
err = gpgme_data_rewind (data);
|
||||
if (err ) {
|
||||
fprintf (stderr, "*** gpgme_data_rewind failed: %d\n", err);
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
err = gpgme_data_read (data, NULL, 0, &nread);
|
||||
if (err && err != GPGME_EOF ) {
|
||||
fprintf (stderr, "*** gpgme_data_read [length] failed: %d\n", err);
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
len = nread; /*(eof returns a length of 0)*/
|
||||
/*fprintf (stderr,"*** %d bytes are availabe\n", (int)len);*/
|
||||
|
||||
/* convert it to the target data type */
|
||||
if (use_bstr) {
|
||||
BSTR bs;
|
||||
unsigned char *helpbuf;
|
||||
|
||||
/* It is easier to allocate some helper storage */
|
||||
helpbuf = _gpgme_malloc (len);
|
||||
if (!helpbuf)
|
||||
return E_OUTOFMEMORY;
|
||||
err = gpgme_data_read (data, helpbuf, len, &nread);
|
||||
if (err ) {
|
||||
_gpgme_free (helpbuf);
|
||||
fprintf (stderr, "*** gpgme_data_read [data] failed: %d\n", err);
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
|
||||
bs = SysAllocStringLen (NULL, len+1);
|
||||
if (!bs) {
|
||||
_gpgme_free (helpbuf);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
for (i=0, p=helpbuf; i < len; i++, p++)
|
||||
bs[i] = *p;
|
||||
bs[i] = 0;
|
||||
_gpgme_free (helpbuf);
|
||||
|
||||
/* Ready */
|
||||
VariantInit (retval);
|
||||
retval->vt = VT_BSTR;
|
||||
retval->u.bstrVal = bs;
|
||||
}
|
||||
#if 0
|
||||
else if (use_byte_array) {
|
||||
array = SafeArrayCreateVector (VT_UI1, 0, len);
|
||||
if (!array)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
p = NULL;
|
||||
hr = SafeArrayAccessData (array, (void**)&p);
|
||||
if (hr) {
|
||||
fprintf (stderr,"*** SafeArrayAccessData failed: hr=%lx\n", hr);
|
||||
SafeArrayDestroyData (array);
|
||||
SafeArrayDestroy (array);
|
||||
return hr;
|
||||
}
|
||||
if (len) {
|
||||
err = gpgme_data_read (data, p, len, &nread);
|
||||
if (err ) {
|
||||
SafeArrayUnaccessData (array);
|
||||
SafeArrayDestroyData (array);
|
||||
SafeArrayDestroy (array);
|
||||
fprintf (stderr, "*** gpgme_data_read [data] failed: %d\n",
|
||||
err);
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
}
|
||||
SafeArrayUnaccessData (array);
|
||||
|
||||
/* pass the data to the caller */
|
||||
VariantInit (retval);
|
||||
retval->vt = (VT_ARRAY|VT_UI1);
|
||||
retval->u.parray = array;
|
||||
}
|
||||
#endif
|
||||
else { /* Create an array of variants of bytes */
|
||||
VARIANT *v;
|
||||
unsigned char *helpbuf;
|
||||
|
||||
/* It is easier to allocate some helper storage */
|
||||
helpbuf = _gpgme_malloc (len);
|
||||
if (!helpbuf)
|
||||
return E_OUTOFMEMORY;
|
||||
err = gpgme_data_read (data, helpbuf, len, &nread);
|
||||
if (err ) {
|
||||
_gpgme_free (helpbuf);
|
||||
fprintf (stderr, "*** gpgme_data_read [data] failed: %d\n", err);
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
|
||||
/* The create the array */
|
||||
array = SafeArrayCreateVector (VT_VARIANT, 0, len);
|
||||
if (!array) {
|
||||
_gpgme_free (helpbuf);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
v = NULL;
|
||||
hr = SafeArrayAccessData (array, (void**)&v);
|
||||
if (hr) {
|
||||
fprintf (stderr,"*** SafeArrayAccessData failed: hr=%lx\n", hr);
|
||||
_gpgme_free (helpbuf);
|
||||
SafeArrayDestroyData (array);
|
||||
SafeArrayDestroy (array);
|
||||
return hr;
|
||||
}
|
||||
|
||||
for (p=helpbuf; len; len--, v++) {
|
||||
VariantInit (v);
|
||||
v->vt = VT_UI1;
|
||||
v->u.bVal = *p;
|
||||
}
|
||||
SafeArrayUnaccessData (array);
|
||||
_gpgme_free (helpbuf);
|
||||
|
||||
/* pass the data to the caller */
|
||||
VariantInit (retval);
|
||||
retval->vt = (VT_ARRAY|VT_VARIANT);
|
||||
retval->u.parray = array;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_SetPlaintext (IGpgme *iface, VARIANT val)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
return set_data_from_variant (&This->plaintext, val,
|
||||
&This->plaintext_given_as_bstr);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetPlaintext (IGpgme *iface, VARIANT *retval)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
/*fprintf (stderr,"*** " __PRETTY_FUNCTION__ "(%p)\n", This );*/
|
||||
return set_data_to_variant (This->plaintext, retval,
|
||||
This->plaintext_given_as_bstr);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_SetCiphertext (IGpgme *iface, VARIANT val)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
return set_data_from_variant (&This->ciphertext, val, NULL);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetCiphertext (IGpgme *iface, VARIANT *retval)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
return set_data_to_variant (This->ciphertext, retval,
|
||||
This->ciphertext_is_armored);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_ClearRecipients (IGpgme *iface)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
gpgme_recipients_release (This->rset); This->rset = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_AddRecipient (IGpgme *iface, BSTR name, signed short int trust)
|
||||
{
|
||||
GpgmeError err;
|
||||
int n;
|
||||
char *p;
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
/*fprintf (stderr,"*** " __PRETTY_FUNCTION__ "(%p, %d)\n",
|
||||
This, (int)trust);*/
|
||||
if (!This->rset) {
|
||||
err = gpgme_recipients_new (&This->rset);
|
||||
if (err)
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
|
||||
n = bstrtoutf8 (name, NULL, 0);
|
||||
p = HeapAlloc (GetProcessHeap(), 0, n );
|
||||
if (!p) {
|
||||
fprintf (stderr,"HeapAlloc failed: ec=%d\n", (int)GetLastError () );
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
if (bstrtoutf8 (name, p, n) < 0) {
|
||||
fprintf (stderr,"problem with bstrtoutf8\n");
|
||||
HeapFree (GetProcessHeap(), 0, p);
|
||||
return E_FAIL;
|
||||
}
|
||||
err = gpgme_recipients_add_name (This->rset, p);
|
||||
HeapFree (GetProcessHeap(), 0, p);
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_ResetSignKeys (IGpgme *iface)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_AddSignKey (IGpgme *iface, BSTR name)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_Encrypt (IGpgme *iface)
|
||||
{
|
||||
GpgmeError err;
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
gpgme_data_release (This->ciphertext);
|
||||
err = gpgme_data_new (&This->ciphertext);
|
||||
if (err)
|
||||
return map_gpgme_error (err);
|
||||
|
||||
|
||||
This->ciphertext_is_armored = gpgme_get_armor (This->mainctx);
|
||||
err = gpgme_op_encrypt (This->mainctx, This->rset,
|
||||
This->plaintext, This->ciphertext);
|
||||
#if 0
|
||||
if (!err ) {
|
||||
char buf[100];
|
||||
size_t nread;
|
||||
|
||||
err = gpgme_data_rewind ( This->ciphertext );
|
||||
if (err )
|
||||
fprintf (stderr, "*** gpgme_data_rewind failed: %d\n", err);
|
||||
while ( !(err = gpgme_data_read ( This->ciphertext,
|
||||
buf, 100, &nread )) ) {
|
||||
fwrite ( buf, nread, 1, stderr );
|
||||
}
|
||||
if (err != GPGME_EOF)
|
||||
fprintf (stderr, "*** gpgme_data_read failed: %d\n", err);
|
||||
err = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return map_gpgme_error (err);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_Sign (IGpgme *iface, short int signmode)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
fprintf (stderr,"*** " __PRETTY_FUNCTION__ "(%p)\n", This );
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_SignEncrypt (IGpgme *iface, short int signmode)
|
||||
{
|
||||
ICOM_THIS (IGpgmeImpl,iface);
|
||||
|
||||
fprintf (stderr,"*** " __PRETTY_FUNCTION__ "(%p)\n", This );
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetSigStatus(GpgmeCtx c, int idx,
|
||||
GpgmeSigStat *r_stat, time_t *r_created );
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetSigKey (GpgmeCtx c, int idx, GpgmeKey *r_key);
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_IGpgme_GetNotation(IGpgme *c, BSTR *retval)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static ICOM_VTABLE(IGpgme) igpgme_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
||||
m_IGpgme_QueryInterface,
|
||||
m_IGpgme_AddRef,
|
||||
m_IGpgme_Release,
|
||||
/* IDispatch methods */
|
||||
m_stub_IDispatch_GetTypeInfoCount,
|
||||
m_stub_IDispatch_GetTypeInfo,
|
||||
m_stub_IDispatch_GetIDsOfNames,
|
||||
m_stub_IDispatch_Invoke,
|
||||
/* Our methods */
|
||||
m_IGpgme_GetVersion,
|
||||
m_IGpgme_GetEngineInfo,
|
||||
m_IGpgme_Cancel,
|
||||
m_IGpgme_SetArmor,
|
||||
m_IGpgme_GetArmor,
|
||||
m_IGpgme_SetTextmode,
|
||||
m_IGpgme_GetTextmode,
|
||||
m_IGpgme_SetPlaintext,
|
||||
m_IGpgme_GetPlaintext,
|
||||
m_IGpgme_SetCiphertext,
|
||||
m_IGpgme_GetCiphertext,
|
||||
m_IGpgme_ClearRecipients,
|
||||
m_IGpgme_AddRecipient,
|
||||
m_IGpgme_ResetSignKeys,
|
||||
m_IGpgme_AddSignKey,
|
||||
m_IGpgme_Encrypt,
|
||||
m_IGpgme_Sign,
|
||||
m_IGpgme_SignEncrypt
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************
|
||||
****************** Gpgme Factory ****************************
|
||||
***************************************************************/
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_GpgmeFactory_QueryInterface (IClassFactory *iface,
|
||||
REFIID refiid, LPVOID *obj)
|
||||
{
|
||||
ICOM_THIS (IClassFactoryImpl,iface);
|
||||
|
||||
/*fprintf (stderr,"*** m_GpgmeFactory_QueryInterface(%p,%s)",
|
||||
This, debugstr_guid(refiid));*/
|
||||
if ( IsEqualGUID (&IID_IUnknown, refiid)
|
||||
|| IsEqualGUID (&IID_IClassFactory, refiid) ) {
|
||||
*obj = This;
|
||||
/*fprintf (stderr," -> got %p\n", obj);*/
|
||||
return 0;
|
||||
}
|
||||
*obj = NULL;
|
||||
/*fprintf (stderr," -> none\n");*/
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
m_GpgmeFactory_AddRef (IClassFactory *iface)
|
||||
{
|
||||
ICOM_THIS(IClassFactoryImpl,iface);
|
||||
return ++(This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
m_GpgmeFactory_Release (IClassFactory *iface)
|
||||
{
|
||||
ICOM_THIS(IClassFactoryImpl,iface);
|
||||
return --(This->ref);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_GpgmeFactory_CreateInstance (IClassFactory *iface, IUnknown *outer,
|
||||
REFIID refiid, LPVOID *r_obj )
|
||||
{
|
||||
/*ICOM_THIS(IClassFactoryImpl,iface);*/
|
||||
|
||||
fprintf (stderr,"*** m_GpgmeFactory_CreateInstance(%s)",
|
||||
debugstr_guid(refiid) );
|
||||
if ( IsEqualGUID (&IID_IUnknown, refiid)
|
||||
|| IsEqualGUID (&IID_IGpgme, refiid) ) {
|
||||
IGpgmeImpl *obj;
|
||||
GpgmeCtx ctx;
|
||||
GpgmeError err;
|
||||
|
||||
|
||||
err = gpgme_new (&ctx);
|
||||
if (err) {
|
||||
fprintf (stderr," -> gpgme_new failed: %s\n", gpgme_strerror (err));
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
obj = HeapAlloc (GetProcessHeap(), 0, sizeof *obj );
|
||||
if ( !obj) {
|
||||
fprintf (stderr," -> out of core\n");
|
||||
gpgme_release (ctx);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
memset (obj, 0, sizeof *obj);
|
||||
|
||||
ICOM_VTBL(obj) = &igpgme_vtbl;
|
||||
obj->ref = 1;
|
||||
obj->mainctx = ctx;
|
||||
{ /* Fixme: need to release some stuff on error */
|
||||
HRESULT hr;
|
||||
ITypeLib *pTypeLib;
|
||||
|
||||
hr = LoadRegTypeLib (&TLBID_Gpgcom, 1, 0, LANG_NEUTRAL, &pTypeLib);
|
||||
if (hr) {
|
||||
fprintf (stderr," -> LoadRegTypeLib failed: %lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
hr = ITypeLib_GetTypeInfoOfGuid (pTypeLib, &IID_IGpgme,
|
||||
&obj->std_disp.tinfo);
|
||||
ITypeLib_Release (pTypeLib);
|
||||
if (hr) {
|
||||
fprintf (stderr," -> GetTypeInfoOfGuid failed: %lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
hr = CreateStdDispatch ((IUnknown*)obj, obj, obj->std_disp.tinfo,
|
||||
&obj->std_disp.disp);
|
||||
if (hr) {
|
||||
fprintf (stderr," -> CreateStdDispatch failed: %lx\n", hr);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
CoAddRefServerProcess ();
|
||||
*r_obj = obj;
|
||||
fprintf (stderr," -> created %p\n", obj );
|
||||
return 0;
|
||||
}
|
||||
fprintf (stderr," -> no interface\n" );
|
||||
*r_obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
m_GpgmeFactory_LockServer (IClassFactory *iface, BOOL dolock )
|
||||
{
|
||||
if (dolock) {
|
||||
CoAddRefServerProcess ();
|
||||
}
|
||||
else {
|
||||
ULONG count = CoReleaseServerProcess ();
|
||||
if (!count && my_exit_event)
|
||||
SetEvent (my_exit_event);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ICOM_VTABLE(IClassFactory) igpgme_factory_vtbl = {
|
||||
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
||||
m_GpgmeFactory_QueryInterface,
|
||||
m_GpgmeFactory_AddRef,
|
||||
m_GpgmeFactory_Release,
|
||||
m_GpgmeFactory_CreateInstance,
|
||||
m_GpgmeFactory_LockServer
|
||||
};
|
||||
static IClassFactoryImpl igpgme_CF = {&igpgme_factory_vtbl, 1 };
|
||||
|
||||
void
|
||||
igpgme_register_exit_event (HANDLE ev)
|
||||
{
|
||||
my_exit_event = ev;
|
||||
}
|
||||
|
||||
|
||||
IClassFactory *
|
||||
igpgme_factory_new ( CLSID *r_clsid )
|
||||
{
|
||||
*r_clsid = CLSID_Gpgme;
|
||||
IClassFactory_AddRef((IClassFactory*)&igpgme_CF);
|
||||
return (IClassFactory*)&igpgme_CF;
|
||||
}
|
||||
|
||||
void
|
||||
igpgme_factory_release ( IClassFactory *factory )
|
||||
{
|
||||
/* it's static - nothing to do */
|
||||
}
|
163
tags/gpgme-1.1.5/complus/igpgme.h
Normal file
163
tags/gpgme-1.1.5/complus/igpgme.h
Normal file
@ -0,0 +1,163 @@
|
||||
/* igpgme.h - COM+ class IGpgme
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
#ifndef IGPGME_H
|
||||
#define IGPGME_H 1
|
||||
|
||||
#include <ole2.h>
|
||||
|
||||
DEFINE_GUID(CLSID_Gpgme, 0x3811fd40, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
#if 0
|
||||
DEFINE_GUID(CLSID_GpgmeData, 0x3811fd41, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
DEFINE_GUID(CLSID_GpgmeKey, 0x3811fd42, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
DEFINE_GUID(CLSID_GpgmeRSet, 0x3811fd43, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
#endif
|
||||
|
||||
DEFINE_GUID(TLBID_Gpgcom, 0x3811fd48, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
DEFINE_GUID(APPID_Gpgcom, 0x3811fd4f, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
|
||||
|
||||
DEFINE_GUID(IID_IGpgme, 0x3811fd50, 0x7f72, 0x11d5,
|
||||
0x8c, 0x9e, 0x00, 0x80, 0xad, 0x19, 0x0c, 0xd5);
|
||||
|
||||
typedef struct IGpgme IGpgme;
|
||||
|
||||
void igpgme_register_exit_event (HANDLE ev);
|
||||
IClassFactory *igpgme_factory_new( CLSID *r_clsid );
|
||||
void igpgme_factory_release ( IClassFactory *factory );
|
||||
|
||||
|
||||
/********************************************
|
||||
***** The IGpgme interface *****************
|
||||
********************************************/
|
||||
|
||||
#define ICOM_INTERFACE IGpgme
|
||||
|
||||
#define IGpgme_METHODS \
|
||||
ICOM_METHOD1(HRESULT,GetVersion, BSTR*,) \
|
||||
ICOM_METHOD1(HRESULT,GetEngineInfo, BSTR*,) \
|
||||
ICOM_METHOD(HRESULT,Cancel) \
|
||||
ICOM_METHOD1(HRESULT,SetArmor,BOOL,) \
|
||||
ICOM_METHOD1(HRESULT,GetArmor,BOOL*,) \
|
||||
ICOM_METHOD1(HRESULT,SetTextmode,BOOL,) \
|
||||
ICOM_METHOD1(HRESULT,GetTextmode,BOOL*,) \
|
||||
ICOM_METHOD1(HRESULT,SetPlaintext,VARIANT,) \
|
||||
ICOM_METHOD1(HRESULT,GetPlaintext,VARIANT*,) \
|
||||
ICOM_METHOD1(HRESULT,SetCiphertext,VARIANT,) \
|
||||
ICOM_METHOD1(HRESULT,GetCiphertext,VARIANT*,) \
|
||||
ICOM_METHOD(HRESULT,ClearRecipients) \
|
||||
ICOM_METHOD2(HRESULT,AddRecipient,BSTR,,signed short int,) \
|
||||
ICOM_METHOD(HRESULT,ResetSignKeys) \
|
||||
ICOM_METHOD1(HRESULT,AddSignKey,BSTR,) \
|
||||
ICOM_METHOD(HRESULT,Encrypt) \
|
||||
ICOM_METHOD1(HRESULT,Sign,signed short int,) \
|
||||
ICOM_METHOD1(HRESULT,SignEncrypt,signed short int,)
|
||||
|
||||
#if 0
|
||||
ICOM_METHOD1(HRESULT,SetKeylistMode,)
|
||||
ICOM_METHOD1(HRESULT,SetPassphraseCB,)
|
||||
ICOM_METHOD1(HRESULT,SetProgressCB,)
|
||||
ICOM_METHOD1(HRESULT,SignersClear,)
|
||||
ICOM_METHOD1(HRESULT,SignersAdd,)
|
||||
ICOM_METHOD1(HRESULT,SignersEnum,)
|
||||
ICOM_METHOD1(HRESULT,GetSigStatus,)
|
||||
ICOM_METHOD1(HRESULT,GetNotation,)
|
||||
#endif
|
||||
|
||||
#define IGpgme_IMETHODS \
|
||||
IDispatch_IMETHODS \
|
||||
IGpgme_METHODS
|
||||
|
||||
ICOM_DEFINE(IGpgme,IDispatch)
|
||||
#undef ICOM_INTERFACE
|
||||
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
#define IGpgme_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
|
||||
#define IGpgme_AddRef(p) ICOM_CALL (AddRef,p)
|
||||
#define IGpgme_Release(p) ICOM_CALL (Release,p)
|
||||
/*** IGpgme methods ***/
|
||||
#define IGpgme_GetVersion(p,r) ICOM_CALL1(GetVersion,p,r)
|
||||
#define IGpgme_GetEngineInfo(p,r) ICOM_CALL1(GetEngineInfo,p,r)
|
||||
#define IGpgme_Cancel(p,a) ICOM_CALL1(Cancel,p,a)
|
||||
#define IGpgme_SetArmor(p,a) ICOM_CALL1(SetArmor,p,a)
|
||||
#define IGpgme_GetArmor(p,a) ICOM_CALL1(GetArmor,p,a)
|
||||
#define IGpgme_SetTextmode(p,a) ICOM_CALL1(SetTextmode,p,a)
|
||||
#define IGpgme_GetTextmode(p,a) ICOM_CALL1(GetTextmode,p,a)
|
||||
#define IGpgme_SetPlaintext(p,a) ICOM_CALL1(SetPlaintext,p,a)
|
||||
#define IGpgme_GetPlaintext(p,a) ICOM_CALL1(GetPlaintext,p,a)
|
||||
#define IGpgme_SetCiphertext(p,a) ICOM_CALL1(SetCiphertext,p,a)
|
||||
#define IGpgme_GetCiphertext(p,a) ICOM_CALL1(GetCiphertext,p,a)
|
||||
#define IGpgme_ClearRecipients(p) ICOM_CALL (ClearRecipients,p)
|
||||
#define IGpgme_AddRecipient(p,a,b) ICOM_CALL2(AddRecipient,p,a,b)
|
||||
#define IGpgme_ResetSignKeys(p) ICOM_CALL (ResetSignKeys,p)
|
||||
#define IGpgme_AddSignKey(p,a) ICOM_CALL (AddSignKey,p,a)
|
||||
#define IGpgme_Encrypt(p) ICOM_CALL (Encrypt,p)
|
||||
#define IGpgme_Sign(p,a) ICOM_CALL (Sign,p,a)
|
||||
#define IGpgme_SignEncrypt(p,a) ICOM_CALL (SignEncrypt,p,a)
|
||||
#if 0
|
||||
#define IGpgme_SetKeylistMode(p,a) ICOM_CALL1(SetKeylistMode,p,a)
|
||||
#define IGpgme_SetPassphraseCB(p,a) ICOM_CALL1(SetPassphraseCB,p,a)
|
||||
#define IGpgme_SetProgressCB(p,a) ICOM_CALL1(SetProgressCB,p,a)
|
||||
#define IGpgme_SignersClear(p,a) ICOM_CALL1(SignersClear,p,a)
|
||||
#define IGpgme_SignersAdd(p,a) ICOM_CALL1(SignersAdd,p,a)
|
||||
#define IGpgme_SignersEnum(p,a) ICOM_CALL1(SignersEnum,p,a)
|
||||
#define IGpgme_GetSigStatus(p,a) ICOM_CALL1(GetSigStatus,p,a)
|
||||
#define IGpgme_GetSigKey(p,a) ICOM_CALL1(GetSigKey,p,a)
|
||||
#define IGpgme_GetNotation(p,a) ICOM_CALL1(GetNotation,p,a)
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/********************************************
|
||||
***** The IGpgmeKey interface **************
|
||||
********************************************/
|
||||
|
||||
#define ICOM_INTERFACE IGpgmeKey
|
||||
|
||||
#define IGpgmeKey_METHODS \
|
||||
ICOM_METHOD1(HRESULT,GetVersion, BSTR,) \
|
||||
ICOM_METHOD1(HRESULT,GetEngineInfo, BSTR,)
|
||||
|
||||
|
||||
#define IGpgmeKey_IMETHODS \
|
||||
IUnknown_IMETHODS \
|
||||
IGpgmeKey_METHODS
|
||||
|
||||
ICOM_DEFINE(IGpgmeKey,IUnknown)
|
||||
#undef ICOM_INTERFACE
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
#define IGpgmeKey_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
|
||||
#define IGpgmeKey_AddRef(p) ICOM_CALL (AddRef,p)
|
||||
#define IGpgmeKey_Release(p) ICOM_CALL (Release,p)
|
||||
/*** IGpgmeKey methods ***/
|
||||
#define IGpgmeKey_GetVersion(p,r) ICOM_CALL1(GetVersion,p,r)
|
||||
#define IGpgmeKey_GetEngineInfo(p,r) ICOM_CALL1(GetEngineInfo,p,r)
|
||||
#endif
|
||||
|
||||
#endif /*IGPGME_H*/
|
||||
|
49
tags/gpgme-1.1.5/complus/main.h
Normal file
49
tags/gpgme-1.1.5/complus/main.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* main.h - GPGME COM+ component
|
||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
#ifndef COMPLUS_MAIN_H
|
||||
#define COMPLUS_MAIN_H
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "stringhelp.h"
|
||||
#include "logging.h"
|
||||
|
||||
|
||||
#define _(a) (a)
|
||||
#define N_(a) (a)
|
||||
|
||||
|
||||
struct {
|
||||
int verbose;
|
||||
int quiet;
|
||||
unsigned int debug;
|
||||
char *homedir;
|
||||
} opt;
|
||||
|
||||
|
||||
|
||||
#endif /* COMPLUS_MAIN_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
70
tags/gpgme-1.1.5/complus/regtlb.c
Normal file
70
tags/gpgme-1.1.5/complus/regtlb.c
Normal file
@ -0,0 +1,70 @@
|
||||
/* regtlb.c - Register a type library
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "oleauto.h"
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
ITypeLib *pTypeLib;
|
||||
wchar_t *fname;
|
||||
HRESULT hr;
|
||||
size_t n;
|
||||
|
||||
if ( argc != 2 ) {
|
||||
fprintf (stderr,"usage: regtlb foo.tlb\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
n = mbstowcs (NULL, argv[1], strlen(argv[1])+1);
|
||||
fprintf (stderr, "need %d bytes\n", (int)n);
|
||||
fname = xmalloc ((n+1)*sizeof *fname);
|
||||
mbstowcs (fname, argv[1], strlen (argv[1])+1);
|
||||
|
||||
hr = CoInitializeEx (NULL, COINIT_MULTITHREADED);
|
||||
if (hr)
|
||||
fprintf (stderr, "CoInitializeEx() failed: hr=%lu\n", hr);
|
||||
|
||||
hr = LoadTypeLibEx (fname, REGKIND_REGISTER, &pTypeLib);
|
||||
if (hr)
|
||||
fprintf (stderr, "LoadTypeLibEx() failed: hr=%lx\n", hr);
|
||||
|
||||
ITypeLib_Release (pTypeLib);
|
||||
|
||||
CoUninitialize ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
157
tags/gpgme-1.1.5/complus/tgpgcom.c
Normal file
157
tags/gpgme-1.1.5/complus/tgpgcom.c
Normal file
@ -0,0 +1,157 @@
|
||||
/* tgpgcom.c - Test the IGpgme classes
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
* GPGME 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.
|
||||
*
|
||||
* GPGME 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
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define INITGUID
|
||||
#include "igpgme.h"
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
IUnknown *pUnknown = NULL;
|
||||
IGpgme *pGpgme;
|
||||
HRESULT hr;
|
||||
BSTR bs;
|
||||
|
||||
hr = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
|
||||
if (hr)
|
||||
fprintf (stderr, "CoInitializeEx() failed: hr=%lu\n", hr);
|
||||
|
||||
fprintf (stderr, "system initialized\n");
|
||||
hr = CoCreateInstance (&CLSID_Gpgme, NULL, CLSCTX_LOCAL_SERVER,
|
||||
&IID_IUnknown, (void**)&pUnknown );
|
||||
if (hr)
|
||||
fprintf (stderr, "CoCreateInstance() failed: hr=%lx\n", hr);
|
||||
if (!pUnknown)
|
||||
exit (1);
|
||||
|
||||
fprintf (stderr,"got object %p - querying %s\n",
|
||||
pUnknown, debugstr_guid(&IID_IGpgme));
|
||||
hr = IGpgme_QueryInterface (pUnknown, &IID_IGpgme, (void**)&pGpgme);
|
||||
if (hr) {
|
||||
fprintf (stderr, "QueryInterface() failed: hr=%lx\n", hr);
|
||||
goto leave;
|
||||
}
|
||||
fprintf (stderr, "got interface %p\n", pGpgme);
|
||||
|
||||
hr = IGpgme_SetArmor (pGpgme, 1);
|
||||
fprintf (stderr, "SetArmor returned %lx\n", hr);
|
||||
|
||||
hr = IGpgme_SetTextmode (pGpgme, 0);
|
||||
fprintf (stderr, "SetTextmode returned %lx\n", hr);
|
||||
|
||||
hr = IGpgme_ClearRecipients (pGpgme);
|
||||
fprintf (stderr, "ClearRecipients returned %lx\n", hr);
|
||||
|
||||
bs = SysAllocString (L"alice");
|
||||
if (!bs)
|
||||
fprintf (stderr, "SysAllocString failed: ec=%d\n", (int)GetLastError());
|
||||
else {
|
||||
int i;
|
||||
|
||||
for (i=-4; i < 12; i++ )
|
||||
fprintf (stderr," %02X", ((unsigned char*)bs)[i] );
|
||||
putc ('\n', stderr);
|
||||
}
|
||||
hr = IGpgme_AddRecipient (pGpgme, bs, -1);
|
||||
fprintf (stderr, "AddRecipients returned %lx\n", hr);
|
||||
|
||||
{
|
||||
SAFEARRAY *sa;
|
||||
VARIANT v;
|
||||
char *p;
|
||||
|
||||
sa = SafeArrayCreateVector (VT_UI1, 0, 20);
|
||||
if (!sa) {
|
||||
fprintf (stderr, "SafeArrayCreateVector failed\n");
|
||||
goto leave;
|
||||
}
|
||||
|
||||
hr = SafeArrayAccessData (sa, (void**)&p);
|
||||
if (hr) {
|
||||
fprintf (stderr,"SafeArrayAccessData failed: hr=%lx\n", hr);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
memcpy (p, "=> Omnis enim res <=", 20 );
|
||||
SafeArrayUnaccessData (sa);
|
||||
|
||||
VariantInit (&v);
|
||||
v.vt = (VT_ARRAY|VT_UI1);
|
||||
v.u.parray = sa;
|
||||
|
||||
hr = IGpgme_SetPlaintext (pGpgme, v );
|
||||
fprintf (stderr, "SetPlaintext returned %lx\n", hr);
|
||||
SafeArrayDestroyData (sa);
|
||||
SafeArrayDestroy (sa);
|
||||
|
||||
VariantClear (&v);
|
||||
}
|
||||
|
||||
hr = IGpgme_Encrypt (pGpgme);
|
||||
fprintf (stderr, "Encrypt returned %lx\n", hr);
|
||||
|
||||
{
|
||||
VARIANT v;
|
||||
|
||||
hr = IGpgme_GetCiphertext (pGpgme, &v);
|
||||
fprintf (stderr, "GetCiphertext returned %lx\n", hr);
|
||||
if (!hr) {
|
||||
if (v.vt != (VT_ARRAY|VT_UI1))
|
||||
fprintf (stderr, "Invalid array typed returned\n");
|
||||
else {
|
||||
unsigned char *p;
|
||||
|
||||
hr = SafeArrayAccessData (v.u.parray, (void**)&p);
|
||||
if (hr)
|
||||
fprintf (stderr,"*** SafeArrayAccessData failed: %lx\n", hr);
|
||||
else {
|
||||
size_t arraysize = v.u.parray->rgsabound[0].cElements;
|
||||
fprintf (stderr,"*** got %d bytes\n", (int)arraysize);
|
||||
for (;arraysize; arraysize--, p++ )
|
||||
putc (*p, stderr);
|
||||
SafeArrayUnaccessData (v.u.parray);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IGpgme_Release (pGpgme);
|
||||
|
||||
leave:
|
||||
CoUninitialize ();
|
||||
fprintf (stderr, "system uninitialized\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
236
tags/gpgme-1.1.5/complus/utf8.c
Normal file
236
tags/gpgme-1.1.5/complus/utf8.c
Normal file
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* UTF-8 support routines
|
||||
*
|
||||
* Copyright 2000 Alexandre Julliard
|
||||
*
|
||||
* Taken from WINE, so the usual WINE copyright applies:
|
||||
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
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <ole2.h>
|
||||
|
||||
/* number of following bytes in sequence based on first byte value (for bytes above 0x7f) */
|
||||
static const char utf8_length[128] =
|
||||
{
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80-0x8f */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90-0x9f */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xa0-0xaf */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xb0-0xbf */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0xc0-0xcf */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 0xd0-0xdf */
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, /* 0xe0-0xef */
|
||||
3,3,3,3,3,3,3,3,4,4,4,4,5,5,0,0 /* 0xf0-0xff */
|
||||
};
|
||||
|
||||
/* first byte mask depending on UTF-8 sequence length */
|
||||
static const unsigned char utf8_mask[6] = { 0x7f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };
|
||||
|
||||
/* minimum Unicode value depending on UTF-8 sequence length */
|
||||
static const unsigned int utf8_minval[6] = { 0x0, 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
|
||||
|
||||
|
||||
/* query necessary dst length for src string */
|
||||
inline static int get_length_wcs_utf8( const WCHAR *src, unsigned int srclen )
|
||||
{
|
||||
int len;
|
||||
|
||||
for (len = 0; srclen; srclen--, src++, len++)
|
||||
{
|
||||
if (*src >= 0x80)
|
||||
{
|
||||
len++;
|
||||
if (*src >= 0x800) len++;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/* wide char to UTF-8 string conversion */
|
||||
/* return -1 on dst buffer overflow */
|
||||
int utf8_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen )
|
||||
{
|
||||
char *orig_dst = dst;
|
||||
|
||||
if (!dstlen) return get_length_wcs_utf8( src, srclen );
|
||||
|
||||
for (; srclen; srclen--, src++)
|
||||
{
|
||||
WCHAR ch = *src;
|
||||
|
||||
if (ch < 0x80) /* 0x00-0x7f: 1 byte */
|
||||
{
|
||||
if (!dstlen--) return -1; /* overflow */
|
||||
*dst++ = ch;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch < 0x800) /* 0x80-0x7ff: 2 bytes */
|
||||
{
|
||||
if ((dstlen -= 2) < 0) return -1; /* overflow */
|
||||
dst[1] = 0x80 | (ch & 0x3f);
|
||||
ch >>= 6;
|
||||
dst[0] = 0xc0 | ch;
|
||||
dst += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* 0x800-0xffff: 3 bytes */
|
||||
|
||||
if ((dstlen -= 3) < 0) return -1; /* overflow */
|
||||
dst[2] = 0x80 | (ch & 0x3f);
|
||||
ch >>= 6;
|
||||
dst[1] = 0x80 | (ch & 0x3f);
|
||||
ch >>= 6;
|
||||
dst[0] = 0xe0 | ch;
|
||||
dst += 3;
|
||||
}
|
||||
return dst - orig_dst;
|
||||
}
|
||||
|
||||
/* query necessary dst length for src string */
|
||||
inline static int get_length_mbs_utf8( const unsigned char *src, int srclen )
|
||||
{
|
||||
int ret;
|
||||
const unsigned char *srcend = src + srclen;
|
||||
|
||||
for (ret = 0; src < srcend; ret++)
|
||||
{
|
||||
unsigned char ch = *src++;
|
||||
if (ch < 0xc0) continue;
|
||||
|
||||
switch(utf8_length[ch-0x80])
|
||||
{
|
||||
case 5:
|
||||
if (src >= srcend) return ret; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) continue;
|
||||
src++;
|
||||
case 4:
|
||||
if (src >= srcend) return ret; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) continue;
|
||||
src++;
|
||||
case 3:
|
||||
if (src >= srcend) return ret; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) continue;
|
||||
src++;
|
||||
case 2:
|
||||
if (src >= srcend) return ret; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) continue;
|
||||
src++;
|
||||
case 1:
|
||||
if (src >= srcend) return ret; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) continue;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* UTF-8 to wide char string conversion */
|
||||
/* return -1 on dst buffer overflow, -2 on invalid input char */
|
||||
int utf8_mbstowcs( int flags, const char *src, int srclen, WCHAR *dst, int dstlen )
|
||||
{
|
||||
int len, count;
|
||||
unsigned int res;
|
||||
const char *srcend = src + srclen;
|
||||
|
||||
if (!dstlen) return get_length_mbs_utf8( src, srclen );
|
||||
|
||||
for (count = dstlen; count && (src < srcend); count--, dst++)
|
||||
{
|
||||
unsigned char ch = *src++;
|
||||
if (ch < 0x80) /* special fast case for 7-bit ASCII */
|
||||
{
|
||||
*dst = ch;
|
||||
continue;
|
||||
}
|
||||
len = utf8_length[ch-0x80];
|
||||
res = ch & utf8_mask[len];
|
||||
|
||||
switch(len)
|
||||
{
|
||||
case 5:
|
||||
if (src >= srcend) goto done; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) goto bad;
|
||||
res = (res << 6) | ch;
|
||||
src++;
|
||||
case 4:
|
||||
if (src >= srcend) goto done; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) goto bad;
|
||||
res = (res << 6) | ch;
|
||||
src++;
|
||||
case 3:
|
||||
if (src >= srcend) goto done; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) goto bad;
|
||||
res = (res << 6) | ch;
|
||||
src++;
|
||||
case 2:
|
||||
if (src >= srcend) goto done; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) goto bad;
|
||||
res = (res << 6) | ch;
|
||||
src++;
|
||||
case 1:
|
||||
if (src >= srcend) goto done; /* ignore partial char */
|
||||
if ((ch = *src ^ 0x80) >= 0x40) goto bad;
|
||||
res = (res << 6) | ch;
|
||||
src++;
|
||||
if (res < utf8_minval[len]) goto bad;
|
||||
if (res >= 0x10000) goto bad; /* FIXME: maybe we should do surrogates here */
|
||||
*dst = res;
|
||||
continue;
|
||||
}
|
||||
bad:
|
||||
if (flags & MB_ERR_INVALID_CHARS) return -2; /* bad char */
|
||||
*dst = (WCHAR)'?';
|
||||
}
|
||||
if (src < srcend) return -1; /* overflow */
|
||||
done:
|
||||
return dstlen - count;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
bstrtoutf8 ( BSTR src, char *dst, size_t dstlen )
|
||||
{
|
||||
size_t srclen, needed;
|
||||
int n;
|
||||
|
||||
srclen = src? SysStringLen (src): 0;
|
||||
|
||||
needed = srclen? (utf8_wcstombs (src, srclen, NULL, 0) + 1) : 1;
|
||||
if (!dst || !dstlen)
|
||||
return needed;
|
||||
if (dstlen < needed)
|
||||
return -1;
|
||||
if (srclen) {
|
||||
n = utf8_wcstombs (src, srclen, dst, dstlen);
|
||||
if (n < 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
n = 0;
|
||||
dst[n] = 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
|
47
tags/gpgme-1.1.5/complus/vbtest.html
Normal file
47
tags/gpgme-1.1.5/complus/vbtest.html
Normal file
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head><title>g10 code - GPGCOM test</title>
|
||||
|
||||
<object id="gpg"
|
||||
classid="CLSID:3811fd40-7f72-11d5-8c9e-0080ad190cd5">
|
||||
</object>
|
||||
|
||||
<script language="VBScript">
|
||||
Sub encrypt_text
|
||||
On error resume next
|
||||
Dim TheForm, plain
|
||||
|
||||
set TheForm = Document.forms ("MyForm")
|
||||
gpg.armor = True
|
||||
gpg.plaintext = TheForm.clear.value
|
||||
gpg.ClearRecipients
|
||||
gpg.AddRecipient TheForm.recp.value
|
||||
Err.Clear
|
||||
gpg.Encrypt
|
||||
if Err <> 0 then
|
||||
TheForm.encoded.value = "Error: " & CStr(Err.Number)
|
||||
else
|
||||
TheForm.encoded.value = gpg.ciphertext
|
||||
end if
|
||||
end sub
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Silly Gpgcom test page</h1>
|
||||
|
||||
<form id="MyForm">
|
||||
<textarea name="clear" rows = 3 cols=40>Please enter the text here</textarea>
|
||||
<p>
|
||||
Encrypt for <input name="recp" value="alice">
|
||||
<input type="button" name="MyAction" value="Encrypt"
|
||||
language="VBScript" onclick="encrypt_text()">
|
||||
<p>
|
||||
<textarea name="encoded" rows=10 cols=75></textarea>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
39
tags/gpgme-1.1.5/complus/vbtest.vbs
Normal file
39
tags/gpgme-1.1.5/complus/vbtest.vbs
Normal file
@ -0,0 +1,39 @@
|
||||
' Demo script to generate a RFC2015 compliant message using Gpgcom
|
||||
Dim gpg, body, crlf
|
||||
|
||||
crlf = chr(10) & chr(13)
|
||||
|
||||
' Create out Gpgcom object
|
||||
set gpg = CreateObject("Gpgcom.Gpgme")
|
||||
' We must use the ASCII armor and switch to textmode
|
||||
gpg.armor = true
|
||||
gpg.textmode = true
|
||||
|
||||
' Set the secret message
|
||||
gpg.plaintext = "This is the secret message." 'or: InputBox('Enter message:")
|
||||
|
||||
' Set the Recipient. You may also use a keyID or an fingerprint
|
||||
gpg.AddRecipient "alice"
|
||||
|
||||
' And encrypt the stuff
|
||||
gpg.encrypt
|
||||
|
||||
' Build the MIME message
|
||||
body = "Content-Type: multipart/encrypted; boundary="
|
||||
body = body & Chr(34) & "=-=-=-=" & Chr(34) & crlf & " protocol=" & Chr(34)
|
||||
body = body & "application/pgp-encrypted" & Chr(34) & crlf & crlf
|
||||
body = body & "--=-=-=-=" & crlf
|
||||
body = body & "Content-Type: application/pgp-encrypted" & crlf & crlf
|
||||
body = body & "Version: 1" & crlf & crlf
|
||||
body = body & "--=-=-=-=" & crlf
|
||||
body = body & "Content-Type: application/octet-stream" & crlf & crlf
|
||||
body = body & gpg.ciphertext
|
||||
body = body & "--=-=-=-=--" & crlf
|
||||
|
||||
' And display it
|
||||
Print body
|
||||
|
||||
' output function for the windows scripting host
|
||||
sub Print(x)
|
||||
WScript.Echo x
|
||||
end sub
|
1432
tags/gpgme-1.1.5/config.guess
vendored
Executable file
1432
tags/gpgme-1.1.5/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1537
tags/gpgme-1.1.5/config.sub
vendored
Executable file
1537
tags/gpgme-1.1.5/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
635
tags/gpgme-1.1.5/configure.ac
Normal file
635
tags/gpgme-1.1.5/configure.ac
Normal file
@ -0,0 +1,635 @@
|
||||
# configure.ac for GPGME
|
||||
# Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH
|
||||
#
|
||||
# This file is part of GPGME.
|
||||
#
|
||||
# GPGME is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# GPGME is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
# (Process this file with autoconf to produce a configure script.)
|
||||
AC_PREREQ(2.59)
|
||||
min_automake_version="1.9.3"
|
||||
|
||||
# Version number: Remember to change it immediately *after* a release.
|
||||
# Make sure to run "svn up" before a "make dist".
|
||||
# See below for the LT versions.
|
||||
#
|
||||
# The CVS version is usually the next intended release version with
|
||||
# the string "-cvs" appended. The reason for this is that tests for a
|
||||
# specific feature can already be done under the assumption that the
|
||||
# CVS version is the most recent one in a branch. To disable the CVS
|
||||
# version for the real release, just comment out the my_iscvs macro.
|
||||
# Note, that we are now using Subversion instead of CVS and append the
|
||||
# SVN revision number to the "cvs" suffix. To make this most useful
|
||||
# for snapshot releases please do an "svn up" right before recreating
|
||||
# the configure script, so that a proper revision number for all files
|
||||
# is available when running a "make distcheck".
|
||||
m4_define(my_version, [1.1.5])
|
||||
#m4_define(my_iscvs, yes)
|
||||
AC_INIT([gpgme], my_version[]m4_ifdef([my_iscvs], [-cvs[]m4_translit(
|
||||
[$Revision$],[Ra-z $:])]),
|
||||
[bug-gpgme@gnupg.org])
|
||||
|
||||
# LT Version numbers, remember to change them just *before* a release.
|
||||
# (Code changed: REVISION++)
|
||||
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
|
||||
# (Interfaces added: AGE++)
|
||||
# (Interfaces removed/changed: AGE=0)
|
||||
#
|
||||
LIBGPGME_LT_CURRENT=17
|
||||
# Subtract 2 from this value if you want to make the LFS transition an
|
||||
# ABI break. [Note to self: Remove this comment with the next regular break.]
|
||||
LIBGPGME_LT_AGE=6
|
||||
LIBGPGME_LT_REVISION=4
|
||||
|
||||
# If the API is changed in an incompatible way: increment the next counter.
|
||||
GPGME_CONFIG_API_VERSION=1
|
||||
##############################################
|
||||
|
||||
|
||||
PACKAGE=$PACKAGE_NAME
|
||||
VERSION=$PACKAGE_VERSION
|
||||
|
||||
AC_CONFIG_SRCDIR(gpgme/gpgme.h)
|
||||
dnl FIXME: Enable this with autoconf 2.59.
|
||||
dnl AC_CONFIG_MACRO_DIR(m4)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||
AM_MAINTAINER_MODE
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
# Enable GNU extensions on systems that have them.
|
||||
AC_GNU_SOURCE
|
||||
|
||||
AH_VERBATIM([_REENTRANT],
|
||||
[/* To allow the use of GPGME in multithreaded programs we have to use
|
||||
special features from the library.
|
||||
IMPORTANT: gpgme is not yet fully reentrant and you should use it
|
||||
only from one thread. */
|
||||
#ifndef _REENTRANT
|
||||
# define _REENTRANT 1
|
||||
#endif])
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
AC_SUBST(LIBGPGME_LT_CURRENT)
|
||||
AC_SUBST(LIBGPGME_LT_AGE)
|
||||
AC_SUBST(LIBGPGME_LT_REVISION)
|
||||
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_SUBST(VERSION)
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
|
||||
|
||||
# Don't default to build static libs.
|
||||
AC_DISABLE_STATIC
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AC_LIBTOOL_RC
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# For now we hardcode the use of version scripts. It would be better
|
||||
# to write a test for this or even implement this within libtool.
|
||||
have_ld_version_script=no
|
||||
case "${host}" in
|
||||
*-*-linux*)
|
||||
have_ld_version_script=yes
|
||||
;;
|
||||
*-*-gnu*)
|
||||
have_ld_version_script=yes
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||
|
||||
GPG_DEFAULT=no
|
||||
GPGSM_DEFAULT=no
|
||||
component_system=None
|
||||
have_dosish_system=no
|
||||
have_w32_system=no
|
||||
case "${host}" in
|
||||
*-mingw32*)
|
||||
# special stuff for Windoze NT
|
||||
have_dosish_system=yes
|
||||
have_w32_system=yes
|
||||
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
|
||||
GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
|
||||
#component_system='COM+'
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
|
||||
if test "$have_pth" = yes; then
|
||||
AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
|
||||
fi
|
||||
AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
|
||||
if test "$have_pthread" = yes; then
|
||||
AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
|
||||
fi
|
||||
|
||||
# XXX: Probably use exec-prefix here?
|
||||
# GPG_DEFAULT='/usr/bin/gpg'
|
||||
# GPGSM_DEFAULT='/usr/bin/gpgsm'
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$have_dosish_system" = yes; then
|
||||
AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
|
||||
[Defined if we run on some of the PCDOS like systems
|
||||
(DOS, Windoze. OS/2) with special properties like
|
||||
no file modes])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
|
||||
|
||||
if test "$have_w32_system" = yes; then
|
||||
AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
|
||||
|
||||
build_w32_glib=no
|
||||
AM_PATH_GLIB_2_0
|
||||
AC_ARG_ENABLE(w32-glib,
|
||||
AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
|
||||
build_w32_glib=$withval)
|
||||
AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
|
||||
|
||||
AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
|
||||
AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS(sys/select.h)
|
||||
|
||||
|
||||
# Type checks.
|
||||
AC_C_INLINE
|
||||
AC_CHECK_SIZEOF(unsigned int)
|
||||
AC_SYS_LARGEFILE
|
||||
AC_TYPE_OFF_T
|
||||
|
||||
# Checks for compiler features.
|
||||
if test "$GCC" = yes; then
|
||||
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
|
||||
if test "$have_w32_system" = yes; then
|
||||
CFLAGS="$CFLAGS -mms-bitfields"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Network library fun.
|
||||
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
|
||||
[NETLIBS="-lnsl $NETLIBS"]))
|
||||
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
|
||||
[NETLIBS="-lsocket $NETLIBS"]))
|
||||
AC_SUBST(NETLIBS)
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_FSEEKO
|
||||
|
||||
AC_REPLACE_FUNCS(vasprintf)
|
||||
if test "$ac_cv_func_vasprintf" != yes; then
|
||||
GNUPG_CHECK_VA_COPY
|
||||
fi
|
||||
|
||||
# Try to find a thread-safe version of ttyname().
|
||||
AC_REPLACE_FUNCS(ttyname_r)
|
||||
if test "$ac_cv_func_ttyname_r" != yes; then
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** ttyname() is not thread-safe and ttyname_r() does not exist
|
||||
***])
|
||||
fi
|
||||
|
||||
# Try to find a thread-safe version of getenv().
|
||||
have_thread_safe_getenv=no
|
||||
jm_GLIBC21
|
||||
if test $GLIBC21 = yes; then
|
||||
have_thread_safe_getenv=yes
|
||||
fi
|
||||
if test $have_thread_safe_getenv = yes; then
|
||||
AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
|
||||
fi
|
||||
have_getenv_r=no
|
||||
AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
|
||||
if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** getenv() is not thread-safe and getenv_r() does not exist
|
||||
***])
|
||||
fi
|
||||
|
||||
# For converting time strings to seconds since Epoch, we need the timegm
|
||||
# function.
|
||||
AC_CHECK_FUNCS(timegm)
|
||||
if test "$ac_cv_func_timegm" != yes; then
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** timegm() not available - a non-thread-safe kludge will be used
|
||||
*** and the TZ variable might be changed at runtime.
|
||||
***])
|
||||
fi
|
||||
|
||||
# Checking for libgpg-error.
|
||||
AM_PATH_GPG_ERROR(1.4,, AC_MSG_ERROR([libgpg-error was not found]))
|
||||
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
|
||||
[The default error source for GPGME.])
|
||||
|
||||
|
||||
|
||||
# Checks for system services
|
||||
NEED_GPG_VERSION_DEFAULT=1.3.0
|
||||
NEED_GPGSM_VERSION_DEFAULT=1.9.6
|
||||
NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
|
||||
NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
|
||||
AC_ARG_WITH(gpg-version,
|
||||
AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
|
||||
NEED_GPG_VERSION=$withval)
|
||||
if test "$NEED_GPG_VERSION" = "yes"; then
|
||||
NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
|
||||
fi
|
||||
if test "$NEED_GPG_VERSION" = "no"; then
|
||||
NEED_GPG_VERSION=0.0.0
|
||||
fi
|
||||
AC_ARG_WITH(gpgsm-version,
|
||||
AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
|
||||
NEED_GPGSM_VERSION=$withval)
|
||||
if test "$NEED_GPGSM_VERSION" = "yes"; then
|
||||
NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
|
||||
fi
|
||||
if test "$NEED_GPGSM_VERSION" = "no"; then
|
||||
NEED_GPGSM_VERSION=0.0.0
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
|
||||
[Min. needed GnuPG version.])
|
||||
AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
|
||||
[Min. needed GPGSM version.])
|
||||
|
||||
|
||||
NO_OVERRIDE=no
|
||||
AC_ARG_WITH(gpg,
|
||||
AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
|
||||
GPG=$withval, NO_OVERRIDE=yes)
|
||||
if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
|
||||
GPG=
|
||||
NO_OVERRIDE=yes
|
||||
if test "$cross_compiling" != "yes"; then
|
||||
AC_PATH_PROG(GPG, gpg)
|
||||
fi
|
||||
if test -z "$GPG"; then
|
||||
GPG="$GPG_DEFAULT"
|
||||
fi
|
||||
fi
|
||||
if test "$GPG" = no; then
|
||||
if test "$NO_OVERRIDE" = "yes"; then
|
||||
if test "$cross_compiling" != "yes"; then
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
|
||||
***])
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
***
|
||||
*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
|
||||
***])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
|
||||
AC_SUBST(GPG)
|
||||
fi
|
||||
dnl Check for GnuPG version requirement.
|
||||
GPG_VERSION=unknown
|
||||
ok=maybe
|
||||
if test -z "$GPG" -o "x$GPG" = "xno"; then
|
||||
ok=no
|
||||
else
|
||||
if test "$cross_compiling" = "yes"; then
|
||||
AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
|
||||
ok=no
|
||||
else
|
||||
if test ! -x "$GPG"; then
|
||||
AC_MSG_WARN([GnuPG not executable, version check disabled])
|
||||
ok=no
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$ok" = "maybe"; then
|
||||
AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
|
||||
req_major=`echo $NEED_GPG_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
|
||||
req_minor=`echo $NEED_GPG_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
|
||||
req_micro=`echo $NEED_GPG_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
|
||||
GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
|
||||
major=`echo $GPG_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
|
||||
minor=`echo $GPG_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
|
||||
micro=`echo $GPG_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
|
||||
|
||||
if test "$major" -gt "$req_major"; then
|
||||
ok=yes
|
||||
else
|
||||
if test "$major" -eq "$req_major"; then
|
||||
if test "$minor" -gt "$req_minor"; then
|
||||
ok=yes
|
||||
else
|
||||
if test "$minor" -eq "$req_minor"; then
|
||||
if test "$micro" -ge "$req_micro"; then
|
||||
ok=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$ok" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
|
||||
fi
|
||||
fi
|
||||
run_gpg_test="$ok"
|
||||
AC_ARG_ENABLE(gpg-test,
|
||||
AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
|
||||
run_gpg_test=$enableval)
|
||||
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
|
||||
AC_SUBST(GPG_PATH)
|
||||
|
||||
NO_OVERRIDE=no
|
||||
AC_ARG_WITH(gpgsm,
|
||||
AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
|
||||
GPGSM=$withval, NO_OVERRIDE=yes)
|
||||
if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
|
||||
GPGSM=
|
||||
NO_OVERRIDE=yes
|
||||
if test "$cross_compiling" != "yes"; then
|
||||
AC_PATH_PROG(GPGSM, gpgsm)
|
||||
fi
|
||||
if test -z "$GPGSM"; then
|
||||
GPGSM="$GPGSM_DEFAULT"
|
||||
fi
|
||||
fi
|
||||
if test "$GPGSM" = no; then
|
||||
if test "$NO_OVERRIDE" = "yes"; then
|
||||
if test "$cross_compiling" != "yes"; then
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
|
||||
***])
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
***
|
||||
*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
|
||||
***])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
|
||||
AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
|
||||
|
||||
|
||||
dnl Check for GPGSM version requirement.
|
||||
GPGSM_VERSION=unknown
|
||||
ok=maybe
|
||||
if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
|
||||
ok=no
|
||||
else
|
||||
if test "$cross_compiling" = "yes"; then
|
||||
AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
|
||||
ok=no
|
||||
else
|
||||
if test ! -x "$GPGSM"; then
|
||||
AC_MSG_WARN([GPGSM not executable, version check disabled])
|
||||
ok=no
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$ok" = "maybe"; then
|
||||
AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
|
||||
req_major=`echo $NEED_GPGSM_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
|
||||
req_minor=`echo $NEED_GPGSM_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
|
||||
req_micro=`echo $NEED_GPGSM_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
|
||||
GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
|
||||
major=`echo $GPGSM_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
|
||||
minor=`echo $GPGSM_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
|
||||
micro=`echo $GPGSM_VERSION | \
|
||||
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
|
||||
|
||||
if test "$major" -gt "$req_major"; then
|
||||
ok=yes
|
||||
else
|
||||
if test "$major" -eq "$req_major"; then
|
||||
if test "$minor" -gt "$req_minor"; then
|
||||
ok=yes
|
||||
else
|
||||
if test "$minor" -eq "$req_minor"; then
|
||||
if test "$micro" -ge "$req_micro"; then
|
||||
ok=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$ok" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
|
||||
fi
|
||||
fi
|
||||
run_gpgsm_test="$ok"
|
||||
AC_ARG_ENABLE(gpgsm-test,
|
||||
AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
|
||||
run_gpgsm_test=$enableval)
|
||||
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
|
||||
|
||||
|
||||
# FIXME: Only build if supported.
|
||||
AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
|
||||
if test "$GPGSM" != "no"; then
|
||||
AC_DEFINE(HAVE_ASSUAN_H, 1,
|
||||
[Defined if we are building with assuan support.])
|
||||
fi
|
||||
|
||||
# Check for funopen
|
||||
AC_CHECK_FUNCS(funopen)
|
||||
if test $ac_cv_func_funopen != yes; then
|
||||
# No funopen but we can implement that in terms of fopencookie.
|
||||
AC_CHECK_FUNCS(fopencookie)
|
||||
if test $ac_cv_func_fopencookie = yes; then
|
||||
AC_REPLACE_FUNCS(funopen)
|
||||
else
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** No implementation of fopencookie or funopen available
|
||||
***])
|
||||
fi
|
||||
fi
|
||||
|
||||
# More assuan replacement functions.
|
||||
AC_REPLACE_FUNCS(isascii)
|
||||
AC_REPLACE_FUNCS(putc_unlocked)
|
||||
AC_REPLACE_FUNCS(memrchr)
|
||||
AC_REPLACE_FUNCS(stpcpy)
|
||||
# Check for unistd.h for setenv replacement function.
|
||||
AC_CHECK_HEADERS(unistd.h)
|
||||
AC_REPLACE_FUNCS(setenv)
|
||||
|
||||
# More assuan checks.
|
||||
AC_CHECK_HEADERS([sys/uio.h])
|
||||
|
||||
# Assuan check for descriptor passing.
|
||||
AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
|
||||
[supports_descriptor_passing=yes],
|
||||
[supports_descriptor_passing=no
|
||||
AC_MSG_WARN([
|
||||
***
|
||||
*** Data structure for sending ancillary data missing.
|
||||
*** Descriptor passing won't work.
|
||||
***])],[
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#if HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(fd-passing,
|
||||
AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
|
||||
use_descriptor_passing=$enableval)
|
||||
|
||||
if test "$supports_descriptor_passing" != "yes"; then
|
||||
use_descriptor_passing=no
|
||||
fi
|
||||
|
||||
if test "$use_descriptor_passing" = "yes"; then
|
||||
AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
|
||||
[Defined if descriptor passing is enabled and supported])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
|
||||
|
||||
# Assuan check for the getsockopt SO_PEERCRED
|
||||
AC_MSG_CHECKING(for SO_PEERCRED)
|
||||
AC_CACHE_VAL(assuan_cv_sys_so_peercred,
|
||||
[AC_TRY_COMPILE([#include <sys/socket.h>],
|
||||
[struct ucred cr;
|
||||
int cl = sizeof cr;
|
||||
getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
|
||||
assuan_cv_sys_so_peercred=yes,
|
||||
assuan_cv_sys_so_peercred=no)
|
||||
])
|
||||
AC_MSG_RESULT($assuan_cv_sys_so_peercred)
|
||||
if test $assuan_cv_sys_so_peercred = yes; then
|
||||
AC_DEFINE(HAVE_SO_PEERCRED, 1,
|
||||
[Defined if SO_PEERCRED is supported (Linux specific)])
|
||||
fi
|
||||
|
||||
if test "$have_w32_system" = yes; then
|
||||
NETLIBS="-lws2_32 $NETLIBS"
|
||||
fi
|
||||
|
||||
# End of assuan checks.
|
||||
|
||||
AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
|
||||
|
||||
# Make the version number in gpgme/gpgme.h the same as the one here.
|
||||
# (this is easier than to have a *.in file just for one substitution)
|
||||
GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
|
||||
|
||||
# Generate values for the DLL version info
|
||||
changequote(,)dnl
|
||||
BUILD_REVISION="`echo '$Revision$' | sed 's/[^0-9]//g'`"
|
||||
changequote([,])dnl
|
||||
test -z "$BUILD_REVISION" && BUILD_REVISION="0"
|
||||
if test "$have_w32_system" = yes; then
|
||||
BUILD_TIMESTAMP=`date --iso-8601=minutes`
|
||||
changequote(,)dnl
|
||||
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
|
||||
changequote([,])dnl
|
||||
BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
|
||||
fi
|
||||
AC_SUBST(BUILD_REVISION)
|
||||
AC_SUBST(BUILD_TIMESTAMP)
|
||||
AC_SUBST(BUILD_FILEVERSION)
|
||||
|
||||
# Add a few constants to help porting to W32
|
||||
AH_VERBATIM([SEPCONSTANTS],
|
||||
[
|
||||
/* Separators as used in $PATH. */
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#define PATHSEP_C ';'
|
||||
#else
|
||||
#define PATHSEP_C ':'
|
||||
#endif
|
||||
])
|
||||
|
||||
AH_BOTTOM([
|
||||
/* Definition of GCC specific attributes. */
|
||||
#if __GNUC__ > 2
|
||||
# define GPGME_GCC_A_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define GPGME_GCC_A_PURE
|
||||
#endif
|
||||
])
|
||||
|
||||
|
||||
# Substitution used for gpgme-config
|
||||
GPGME_CONFIG_LIBS="-lgpgme"
|
||||
GPGME_CONFIG_CFLAGS=""
|
||||
AC_SUBST(GPGME_CONFIG_API_VERSION)
|
||||
AC_SUBST(GPGME_CONFIG_LIBS)
|
||||
AC_SUBST(GPGME_CONFIG_CFLAGS)
|
||||
|
||||
# Frob'da Variables
|
||||
LTLIBOBJS=`echo "$LIB@&t@OBJS" |
|
||||
sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
|
||||
AC_SUBST(LTLIBOBJS)
|
||||
|
||||
#
|
||||
# Create config files
|
||||
|
||||
AC_CONFIG_FILES(Makefile assuan/Makefile gpgme/Makefile
|
||||
tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
|
||||
doc/Makefile complus/Makefile
|
||||
gpgme/versioninfo.rc)
|
||||
AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
|
||||
AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
|
||||
AC_OUTPUT
|
||||
|
||||
echo "
|
||||
GPGME v${VERSION} has been configured as follows:
|
||||
|
||||
GnuPG path: $GPG
|
||||
GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
|
||||
|
||||
GpgSM path: $GPGSM
|
||||
GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
|
||||
|
||||
GPGME Pthread: $have_pthread
|
||||
GPGME Pth: $have_pth
|
||||
"
|
472
tags/gpgme-1.1.5/depcomp
Executable file
472
tags/gpgme-1.1.5/depcomp
Executable file
@ -0,0 +1,472 @@
|
||||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. This file always lives in the current directory.
|
||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||
# $object doesn't have directory information.
|
||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
outname="$stripped.o"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
||||
tmpdepfile2="$dir.libs/$base.d"
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1="$dir$base.o.d"
|
||||
tmpdepfile2="$dir$base.d"
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a space and a tab in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
768
tags/gpgme-1.1.5/doc/ChangeLog
Normal file
768
tags/gpgme-1.1.5/doc/ChangeLog
Normal file
@ -0,0 +1,768 @@
|
||||
2007-06-05 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Advanced Key Editing): New section.
|
||||
|
||||
2007-05-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* Makefile.am (online): New target.
|
||||
|
||||
2007-05-18 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Error Strings): Fix documentation of
|
||||
gpgme_strerror_r.
|
||||
|
||||
2006-11-01 Moritz Schulte <moritz@g10code.com>
|
||||
|
||||
* gpgme.texi (Data Buffer I/O Operations): Fixed entry for
|
||||
gpgme_data_seek: OFFSET is not a pointer; some s/whence/offset/.
|
||||
|
||||
2006-09-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Destroying Data Buffers): Clarify that
|
||||
gpgme_data_release_and_get_mem destroys DH unconditionally.
|
||||
|
||||
2005-03-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Library Version Check): Make example code compatible
|
||||
to W32 systems.
|
||||
|
||||
2006-06-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Passphrase Callback): Fix inverted condition in
|
||||
description.
|
||||
|
||||
2005-12-20 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgme.texi (Verify): Document pka_trust.
|
||||
|
||||
2005-12-06 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgme.texi (Key Management): Updated to match the fixes for
|
||||
subkey fingerprints and theg secret flag.
|
||||
|
||||
2005-10-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Destroying Data Buffers): Document gpgme_free.
|
||||
|
||||
2005-10-02 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Management): Add the new member notations of
|
||||
gpgme_sig_key_t.
|
||||
(Key Listing Mode): Document GPGME_KEYLIST_MODE_SIG_NOTATIONS.
|
||||
|
||||
2005-10-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: Enclose all return parameters of deftypefuns in
|
||||
curly brackets.
|
||||
|
||||
* gpgme.texi (Signature Notation Data): New section.
|
||||
(Verify): Added more about the notation data structure.
|
||||
|
||||
2005-09-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Data Buffer I/O Operations, Data Buffer Meta-Data):
|
||||
New subsections.
|
||||
|
||||
* gpgme.texi: Replace plaintext_filename with file_name.
|
||||
|
||||
* gpgme.texi (Key Management): Document is_qualified.
|
||||
|
||||
2005-07-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Decrypt): Add plaintext_filename to
|
||||
gpgme_decrypt_result_t.
|
||||
(Verify): Likewise for gpgme_verify_result_t.
|
||||
|
||||
2005-06-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Add information about new fields in
|
||||
gpgme_signature_t.
|
||||
|
||||
* gpgme.texi (Decrypt): Add gpgme_recipient_t.
|
||||
|
||||
2005-05-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Listing Mode): Fix return type of
|
||||
gpgme_set_keylist_mode.
|
||||
Reported by "Sergio" <ml_sergico@virgilio.it>.
|
||||
|
||||
2005-04-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Included Certificates): Document
|
||||
GPGME_INCLUDE_CERTS_DEFAULT.
|
||||
|
||||
2005-01-12 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Engine Configuration): New section.
|
||||
(Crypto Engine): New subsection.
|
||||
|
||||
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* lesser.texi (Library Copying): Change from @appendixsec to
|
||||
@appendix.
|
||||
* gpgme.texi (Features): Change reference to GPL to one to LGPL.
|
||||
|
||||
* Makefile.am: Change license to LGPL.
|
||||
(gpgme_TEXINFOS): Replace gpl.texi with lesser.texi.
|
||||
|
||||
* gpgme.texi: Change license to LGPL (also for documentation of
|
||||
GPGME's license).
|
||||
* lesser.texi: New file.
|
||||
* gpl.texi: File removed.
|
||||
|
||||
* gpgme.texi (Creating Contexts): Fix cut&paste error. Reported
|
||||
by Noel Torres <envite@rolamasao.org>.
|
||||
|
||||
2004-09-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (gpgme_TEXINFOS): Remove fdl.texi.
|
||||
* gpgme.texi: Do not include fdl.texi. Change license to GPL.
|
||||
* fdl.texi: File removed.
|
||||
|
||||
2004-09-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Management): Change type of keylist_mode in
|
||||
gpgme_key_t to gpgme_keylist_mode_t.
|
||||
|
||||
2004-09-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Passphrase Callback): Fix last change.
|
||||
|
||||
2004-09-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Passphrase Callback): Document
|
||||
GPG_ERR_NOT_IMPLEMENTED.
|
||||
|
||||
* gpgme.texi: Update copyright year for tex version.
|
||||
|
||||
2004-07-29 Moritz Schulte <moritz@g10code.com>
|
||||
|
||||
* gpgme.texi (Verify): Fix gpgme_get_key example (ancient
|
||||
force_update argument was still there).
|
||||
|
||||
2004-06-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Listing Keys): Elaborate on the length restrictions
|
||||
on search patterns.
|
||||
|
||||
* gpgme.texi (Decrypt and Verify): Document the NO_DATA error
|
||||
code.
|
||||
(Verify): Document the relationship between gpgme_op_verify_result
|
||||
and the decrypt and verify operations.
|
||||
|
||||
2004-05-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.text (Verify): Document GPG_ERR_CERT_REVOKED status.
|
||||
|
||||
* gpgme.texi (Decrypt): Add note about new field wrong_key_usage
|
||||
of gpgme_decrypt_result_t.
|
||||
|
||||
* gpgme.texi (Key Management): Add note about new field
|
||||
keylist_mode of gpgme_key_t.
|
||||
|
||||
2004-04-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Correct type of member wrong_key_usage.
|
||||
|
||||
2004-03-29 Moritz Schulte <moritz@duesseldorf.ccc.de>
|
||||
|
||||
* gpgme.texi (Verify): Fix type of gpgme_op_verify_result.
|
||||
* gpgme.texi (Key Listing Mode): Typo fix.
|
||||
|
||||
2004-03-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Library Version Check): Fix the instruction when to
|
||||
set the locale.
|
||||
|
||||
2004-03-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (I/O Callback Example Qt): New section by Marc Mutz.
|
||||
|
||||
2004-02-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (cancellation): New section.
|
||||
|
||||
2004-02-17 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Key Listing Mode): Doc KEYLIST_MODE_VALIDATE.
|
||||
|
||||
2004-02-06 Moritz Schulte <mo@g10code.com>
|
||||
|
||||
* gpgme.texi: A couple of small fixes regarding the Largfile
|
||||
Support section.
|
||||
|
||||
2004-02-01 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Largefile Support): New section.
|
||||
|
||||
2004-01-13 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Management): Fix exportable field.
|
||||
|
||||
2003-12-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Management): Rename member class in
|
||||
gpgme_key_sig_t to sig_class.
|
||||
(Creating a Signature): Likewise for gpgme_signature_t.
|
||||
|
||||
2003-12-23 Moritz Schulte <mo@g10code.com>
|
||||
|
||||
* gpgme.texi (Listing Keys): Minor clarification for
|
||||
gpgme_get_key.
|
||||
|
||||
2003-10-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Signal Handling): New section.
|
||||
|
||||
2003-09-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Multi Threading): Correct documentation on memory
|
||||
synchronization requirement.
|
||||
|
||||
* gpgme.texi (Locale): New section.
|
||||
(Multi Threading): Set locale in example.
|
||||
|
||||
2003-09-13 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Error Strings): Add gpgme_strerror_r.
|
||||
|
||||
2003-09-13 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Multi Threading): Update documentation.
|
||||
|
||||
2003-09-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Header): We don't use the assuan namespace anymore.
|
||||
Document new thread options.
|
||||
|
||||
2003-08-14 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Creating a Signature): Change type of member class
|
||||
to unsigned int.
|
||||
|
||||
2003-08-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Get error code from SIG->status in the code
|
||||
for gpgme_get_sig_status.
|
||||
|
||||
2003-07-31 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Management): Add can_authenticate flag.
|
||||
|
||||
* gpgme.texi (Listing Keys): Document GPG_ERR_AMBIGUOUS_NAME for
|
||||
gpgme_get_key.
|
||||
|
||||
2003-07-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Remove variable.
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Bad passphrase is only
|
||||
possible with symmetric encryption, change the wording to reflect
|
||||
that.
|
||||
|
||||
* gpgme.texi (Creating a Signature): Document
|
||||
GPG_ERR_UNUSABLE_SECKEY.
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Mention encrypt and sign
|
||||
operations in result function.
|
||||
(Creating a Signature): Likewise.
|
||||
|
||||
2003-07-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Listing Mode): Remove word duplication.
|
||||
(Listing Keys): Remove mentioning of force argument.
|
||||
(Verify): Don't mention r_stat. Fix some typos.
|
||||
(Decrypt and Verify): Correct info how to get the result. Don't
|
||||
mention r_stat.
|
||||
(Manipulating Data Buffers): Fix documentation of return value.
|
||||
(Listing Keys): Update examples.
|
||||
(Decrypt): Result might also be available when operation failed.
|
||||
(Verify): Result might also be available when operation failed.
|
||||
All spotted by Stéphane Corthésy.
|
||||
|
||||
2003-07-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Error Sources): Fix cut and paste error.
|
||||
|
||||
2003-07-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Management): Clarify difference between can_sign
|
||||
and can_certify.
|
||||
(Information About Keys): Likewise for GPGME_ATTR_CAN_SIGN and
|
||||
GPGME_ATTR_CAN_CERTIFY.
|
||||
|
||||
2003-07-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Progress Meter Callback): Change return type of
|
||||
gpgme_progress_cb_t to void.
|
||||
|
||||
2003-06-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: Add 2003 to copyright notice.
|
||||
|
||||
* gpgme.texi (Header): Fix name space documentation on
|
||||
libgpg-error.
|
||||
|
||||
2003-06-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Multi Threading): Remove reference to
|
||||
gpgme_recipients_t.
|
||||
|
||||
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Crypto Operations): Rename gpgme_invalid_user_id_t
|
||||
to gpgme_invalid_key_t.
|
||||
|
||||
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: Change error codes to GPG_ERR_* variants.
|
||||
(Error Handling): Rewritten.
|
||||
|
||||
2003-05-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Exporting Keys): Change and document prototypes.
|
||||
Add new gpgme_op_export_ext and gpgme_op_export_ext_start
|
||||
variants.
|
||||
(Selecting Recipients): Section removed.
|
||||
(Encrypting a Plaintext): Change prototypes and document the
|
||||
changes.
|
||||
|
||||
2003-05-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Exporting Keys): Change argument type from
|
||||
gpgme_recipient_t to gpgme_user_id_t.
|
||||
(Encrypting a Plaintext): Likewise.
|
||||
(Selecting Recipients): Rewritten.
|
||||
|
||||
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Protocol Selection): Do not use @acronym in @node
|
||||
because that breaks texi2dvi.
|
||||
|
||||
* gpgme.texi (Passphrase Callback): Document new prototype.
|
||||
|
||||
2003-05-18 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Header): Remove Gpgme as namespace prefix. Add
|
||||
_GPGME to namespace prefix.
|
||||
* gpgme.texi (Multi Threading): Add note about link order.
|
||||
|
||||
2003-05-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Listing Keys): Document what happens if key is not
|
||||
found.
|
||||
|
||||
* gpgme.texi (Importing Keys): Fix cut and paste error.
|
||||
|
||||
2003-04-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Remove reference to
|
||||
gpgme_get_op_info.
|
||||
(Detailed Results): Subsection removed.
|
||||
|
||||
* gpgme.texi (Key Listing Mode): Add GPGME_KEYLIST_MODE_SIGS.
|
||||
(Manipulating Keys): Add obsoleteness note.
|
||||
(Key Signatures): Likewise.
|
||||
(Information About Keys): Likewise.
|
||||
(Key Management): Add new data types GpgmeSubkey, GpgmeKeySig,
|
||||
GpgmeUserID, and all the information about GpgmeKey.
|
||||
|
||||
2003-04-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Listing Keys): Remove force_update argument from
|
||||
gpgme_get_key.
|
||||
|
||||
* gpgme.texi (Trust Item Management): Add data members of
|
||||
GpgmeTrustItem type.
|
||||
(Information About Trust Items): Add note about obsoleteness.
|
||||
(Manipulating Trust Items): Add gpgme_trust_item_ref and
|
||||
gpgme_trust_item_unref.
|
||||
|
||||
2003-04-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Rewritten to take into account new and
|
||||
deprecated functions and data types.
|
||||
|
||||
* gpgme.texi (Decrypt): Descript gpgme_op_decrypt_result and
|
||||
GpgmeDecryptResult.
|
||||
|
||||
2003-04-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Add info about
|
||||
GpgmeEncryptResult and gpgme_op_encrypt_result.
|
||||
|
||||
* gpgme.texi (Creating a Signature): Add info about
|
||||
GpgmeNewSignature, GpgmeSignResult and gpgme_op_sign_result.
|
||||
(Crypto Operations): Add GpgmeInvalidUserID.
|
||||
(Algorithms): New chapter.
|
||||
|
||||
* gpgme.texi (Deleting Keys): Document
|
||||
GPGME_Ambiguous_Specification.
|
||||
(Error Values): Remove GPGME_Invalid_Type and GPGME_Invalid_Mode.
|
||||
Add GPGME_Unknown_Reason, GPGME_Not_Found,
|
||||
GPGME_Ambiguous_Specification, GPGME_Wrong_Key_Usage,
|
||||
GPGME_Key_Revoked, GPGME_Key_Expired, GPGME_No_CRL_Known,
|
||||
GPGME_CRL_Too_Old, GPGME_Policy_Mismatch, GPGME_No_Secret_Key,
|
||||
GPGME_Key_Not_Trusted, GPGME_Issuer_Missing, GPGME_Chain_Too_Long,
|
||||
GPGME_Unsupported_Algorithm, GPGME_Sig_Expired,
|
||||
GPGME_Bad_Signature, GPGME_No_Public_Key.
|
||||
|
||||
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Importing Keys): Change GPGME_IMPORT_PRIVATE to
|
||||
GPGME_IMPORT_SECRET.
|
||||
|
||||
* gpgme.texi (Importing Keys): Remove note about gpgme_get_op_info.
|
||||
(Detailed Results): Remove note about import.
|
||||
|
||||
* gpgme.texi (Importing Keys): Add documentation for
|
||||
GpgmeImportStatus, GpgmeImportResult and gpgme_op_import_result.
|
||||
|
||||
* gpgme.texi (Generating Keys): Fix documentation of public and
|
||||
secret arguments.
|
||||
|
||||
2003-04-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Generating Keys): Document changed gpgme_op_genkey
|
||||
and new gpgme_op_genkey_result function. Document
|
||||
GpgmeGenKeyResult data type.
|
||||
|
||||
* gpgme.texi (Error Values): Rename GPGME_No_Passphrase to
|
||||
GPGME_Bad_Passphrase.
|
||||
* gpgme.texi (Decrypt): Likewise.
|
||||
(Decrypt and Verify): Likewise.
|
||||
(Creating a Signature): Likewise.
|
||||
(Encrypting a Plaintext): Likewise.
|
||||
|
||||
* gpgme.texi (Error Values): Rename GPGME_No_Recipients to
|
||||
GPGME_No_UserID and GPGME_Invalid_Recipient to
|
||||
GPGME_Invalid_UserID.
|
||||
(Encrypting a Plaintext): Likewise.
|
||||
|
||||
* gpgme.texi (Error Values): Remove GPGME_Busy and GPGME_No_Request.
|
||||
(Listing Keys): Likewise.
|
||||
(Listing Trust Items): Likewise.
|
||||
|
||||
2003-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Cancelling an Operation): Removed.
|
||||
(Passphrase Callback): Document new type for GpgmePassphraseCb.
|
||||
|
||||
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Engine Information): Rename member part to
|
||||
file_name.
|
||||
|
||||
* gpgme.texi (Protocols and Engines): Document
|
||||
gpgme_get_protocol_name.
|
||||
|
||||
* gpgme.texi (Engine Information): Rewritten.
|
||||
|
||||
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (I/O Callback Interface): Document new even
|
||||
GPGME_EVENT_START.
|
||||
(Waiting For Completion): Document new possible return values.
|
||||
(I/O Callback Interface): Document return type of GpgmeIOCb.
|
||||
|
||||
2003-01-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Hooking Up Into Idle Time): Section removed.
|
||||
|
||||
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Drop R_STAT argument in gpgme_op_verify.
|
||||
* gpgme.texi (Decrypt and Verify): Likewise for
|
||||
gpgme_op_decrypt_verify.
|
||||
|
||||
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Information About Keys): Document that
|
||||
GPGME_ATTR_IS_SECRET is not representable as a string anymore.
|
||||
|
||||
2002-12-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Signatures): New section.
|
||||
(Listing Keys): Add gpgme_get_key.
|
||||
|
||||
2002-12-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Memory Based Data Buffers): New subsection.
|
||||
(File Based Data Buffers): Likewise.
|
||||
(Callback Based Data Buffers): Likewise.
|
||||
(Manipulating Data Buffers): Update interfaces. Add
|
||||
gpgme_data_seek.
|
||||
* gpgme.texi (Engine Version Check): Remove gpgme_check_engine.
|
||||
|
||||
2002-11-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Document the new interface.
|
||||
|
||||
2002-11-19 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Generating Keys): Document new argument to
|
||||
gpgme_op_genkey.
|
||||
|
||||
2002-11-05 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Fix prototype of gpgme_get_sig_key.
|
||||
Reported by Miguel Coca <e970095@zipi.fi.upm.es>.
|
||||
|
||||
2002-08-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Selecting Signers): Fix reference count.
|
||||
|
||||
2002-08-21 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Header): Document name space.
|
||||
|
||||
2002-08-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Importing Keys): Document gpgme_op_import_ext.
|
||||
|
||||
* gpgme.texi (Importing Keys): Undocument EOF.
|
||||
|
||||
2002-08-14 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Information About Keys): Changed GPGME_ATTR_TYPE.
|
||||
|
||||
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Deleting Keys): Say that secret keys might not be
|
||||
deleted.
|
||||
|
||||
2002-07-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Information About Keys): Document (badly) the new
|
||||
key attributes.
|
||||
|
||||
* gpgme.texi (Manipulating Data Buffers): Mention that backend
|
||||
tries to detect encoding automatically.
|
||||
|
||||
2002-07-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Run Control): Update this section.
|
||||
(Waiting For Completion): Likewise for this subsection.
|
||||
(Cancelling an Operation): Likewise for this subsection.
|
||||
(Using External Event Loops): New subsection with several
|
||||
subsubsections.
|
||||
|
||||
2002-06-28 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Multi Threading): Remove item about the need to
|
||||
synchronize anything against gpgme_wait (except gpgme_wait
|
||||
itself).
|
||||
|
||||
2002-06-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Information About Keys): Fix documentation for IDX.
|
||||
(Information About Trust Items): Likewise.
|
||||
|
||||
2002-06-26 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Importing Keys): Document the return value -1 of
|
||||
gpgme_op_import.
|
||||
|
||||
2002-06-20 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Verify): Explain the new whatidx variable.
|
||||
|
||||
2002-06-10 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Verify): Document attribute GPGME_ATTR_ERRTOK.
|
||||
|
||||
2002-06-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Multi Threading): Document new autodetection.
|
||||
|
||||
2002-06-04 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (DISTCLEANFILES): New variable.
|
||||
|
||||
2002-05-26 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: Some typographical correctons throughout.
|
||||
|
||||
2002-05-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Using Automake): New section.
|
||||
|
||||
2002-05-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Multi Threading): Escape { and }.
|
||||
|
||||
2002-05-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Overview): Replace note about thread-safeness.
|
||||
(Multi Threading): New section.
|
||||
|
||||
2002-05-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Manipulating Data Buffers): Changed some data types
|
||||
to void*.
|
||||
(Protocol Selection): Added gpgme_get_protocol.
|
||||
(Verify): Updated to include the new attribute fucntions and
|
||||
status codes.
|
||||
|
||||
2002-04-27 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Manipulating Data Buffers): New type GpgmeDataEncoding.
|
||||
|
||||
2002-04-23 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Passphrase Callback): Document that either return
|
||||
argument can be NULL.
|
||||
(Progress Meter Callback): Likewise.
|
||||
|
||||
2002-04-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Passphrase Callback): Fix small typo. Document the
|
||||
new function gpgme_get_passphrase_cb.
|
||||
(Progress Meter Callback): Document the new function
|
||||
gpgme_get_progress_cb.
|
||||
|
||||
2002-04-16 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Creating a Signature): Fix function name. Reported
|
||||
by Wichert Ackerman <wichert@debian.org>.
|
||||
|
||||
2002-03-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (direntry): End index entry with a full stop.
|
||||
Patch submitted by Jose Carlos Garcia Sogo <jsogo@debian.org>.
|
||||
|
||||
2002-03-17 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Detailed Results): Fix syntax error in last change.
|
||||
|
||||
2002-03-08 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* gpgme.texi (Detailed Results): Import does also return info.
|
||||
|
||||
2002-03-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Document symmetric
|
||||
encryption.
|
||||
|
||||
2002-03-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Error Strings): Add example.
|
||||
* gpgme.texi (Listing Keys): Likewise.
|
||||
|
||||
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Information About Keys): Document GPGME_ATTR_EXPIRE.
|
||||
|
||||
2002-03-03 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Verify): Document verification of normal and
|
||||
cleartext signatures.
|
||||
|
||||
2002-02-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Listing Keys): Document gpgme_op_keylist_ext_start.
|
||||
|
||||
2002-02-27 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Document
|
||||
GPGME_Invalid_Recipients.
|
||||
(Error Values): Likewise.
|
||||
|
||||
2002-02-26 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Encrypting a Plaintext): Document
|
||||
gpgme_op_encrypt_sign and gpgme_op_encrypt_sign_start.
|
||||
|
||||
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Creating a Signature): Add a note about
|
||||
certificates to include.
|
||||
(Included Certificates): New section.
|
||||
|
||||
2002-02-09 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Detailed Results): Remove literal tags.
|
||||
(Generating Keys): Update documentation.
|
||||
|
||||
* gpgme.texi (Generating Keys): Fix syntax error.
|
||||
|
||||
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Waiting For Completion): Adjust doc to changes in
|
||||
the code.
|
||||
|
||||
2002-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Key Listing Mode): Update documentation.
|
||||
|
||||
2002-01-31 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Generating Keys): Document error at creation
|
||||
failure.
|
||||
|
||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Deleting Keys): Document new error values.
|
||||
|
||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Importing Keys): Add reference to gpgme_get_op_info.
|
||||
|
||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: Some spell checking.
|
||||
|
||||
2002-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: Add all the gpgme_op_*_start functions.
|
||||
Fill the concept index with many, many entries.
|
||||
|
||||
2002-01-29 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Run Control): New section.
|
||||
(Verify): Docuent gpgme_get_notation.
|
||||
(More Information): New section describing gpgme_get_op_info.
|
||||
|
||||
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Passphrase callback): Change GpgmePassphraseCb's
|
||||
R_HD type from void* to void**.
|
||||
|
||||
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Creating data buffers): Change
|
||||
gpgme_data_new_from_filepart's LENGTH type from off_t to size_t.
|
||||
|
||||
2002-01-22 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Generating keys): New subsection.
|
||||
(Exporting keys): Likewise.
|
||||
(Importing keys): Likewise.
|
||||
(Deleting keys): Likewise.
|
||||
|
||||
2002-01-16 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi: g10Code -> g10 Code
|
||||
|
||||
* gpgme.texi (Top): Complete detailmenu.
|
||||
|
||||
* gpgme.texi: Convert embarassing cruft to the real thing.
|
||||
|
||||
2002-01-16 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* ChangeLog: New file.
|
||||
* gpgme.texi: Likewise.
|
||||
* gpl.texi: Likewise.
|
||||
* fdl.texi: Likewise.
|
||||
* Makefile.am (info_TEXINFOS): New variable.
|
||||
(gpgme_TEXINFOS): Likewise.
|
||||
|
||||
Copyright 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is free software; as a special exception the author gives
|
||||
unlimited permission to copy and/or distribute it, with or without
|
||||
modifications, as long as this notice is preserved.
|
||||
|
||||
This file 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.
|
34
tags/gpgme-1.1.5/doc/Makefile.am
Normal file
34
tags/gpgme-1.1.5/doc/Makefile.am
Normal file
@ -0,0 +1,34 @@
|
||||
# doc - Automake template
|
||||
# Copyright (C) 2001, 2004 g10 Code GmbH
|
||||
#
|
||||
# This file is part of GPGME.
|
||||
#
|
||||
# GPGME is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# GPGME is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
DISTCLEANFILES = gpgme.tmp
|
||||
|
||||
info_TEXINFOS = gpgme.texi
|
||||
gpgme_TEXINFOS = lesser.texi
|
||||
|
||||
online: gpgme.html gpgme.pdf
|
||||
set -e; \
|
||||
echo "Uploading current manuals to www.gnupg.org ..."; \
|
||||
user=werner ; \
|
||||
(cd gpgme.html && rsync -vr --exclude='.svn' . \
|
||||
$${user}@cvs.gnupg.org:webspace/manuals/gpgme/ ); \
|
||||
rsync -v gpgme.pdf $${user}@cvs.gnupg.org:webspace/manuals/
|
||||
|
5469
tags/gpgme-1.1.5/doc/gpgme.texi
Normal file
5469
tags/gpgme-1.1.5/doc/gpgme.texi
Normal file
File diff suppressed because it is too large
Load Diff
565
tags/gpgme-1.1.5/doc/lesser.texi
Normal file
565
tags/gpgme-1.1.5/doc/lesser.texi
Normal file
@ -0,0 +1,565 @@
|
||||
@node Library Copying
|
||||
@appendix GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
@cindex LGPL, Lesser General Public License
|
||||
@center Version 2.1, February 1999
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 1991, 1999 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.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence the
|
||||
version number 2.1.]
|
||||
@end display
|
||||
|
||||
@appendixsubsec Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software---to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software---typically libraries---of the Free
|
||||
Software Foundation and other authors who decide to use it. You can use
|
||||
it too, but we suggest you first think carefully about whether this
|
||||
license or the ordinary General Public License is the better strategy to
|
||||
use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of it
|
||||
in new free programs; and that you are informed that you can do these
|
||||
things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the @dfn{Lesser} General Public License because it
|
||||
does @emph{Less} to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
``work based on the library'' and a ``work that uses the library''. The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
@iftex
|
||||
@appendixsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center GNU LESSER GENERAL PUBLIC LICENSE
|
||||
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end ifinfo
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other
|
||||
authorized party saying it may be distributed under the terms of this
|
||||
Lesser General Public License (also called ``this License''). Each
|
||||
licensee is addressed as ``you''.
|
||||
|
||||
A ``library'' means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The ``Library'', below, refers to any such software library or work
|
||||
which has been distributed under these terms. A ``work based on the
|
||||
Library'' means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term ``modification''.)
|
||||
|
||||
``Source code'' for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
@item
|
||||
You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
@item
|
||||
You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
The modified work must itself be a software library.
|
||||
|
||||
@item
|
||||
You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
@item
|
||||
You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
@item
|
||||
If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
@end enumerate
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
@item
|
||||
You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
@item
|
||||
You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
@item
|
||||
A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a ``work that uses the Library''. Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a ``work that uses the Library'' with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a ``work that uses the
|
||||
library''. The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a ``work that uses the Library'' uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
@item
|
||||
As an exception to the Sections above, you may also combine or
|
||||
link a ``work that uses the Library'' with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable ``work that
|
||||
uses the Library'', as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
@item
|
||||
Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the
|
||||
library already present on the user's computer system, rather than
|
||||
copying library functions into the executable, and (2) will operate
|
||||
properly with a modified version of the library, if the user installs
|
||||
one, as long as the modified version is interface-compatible with the
|
||||
version that the work was made with.
|
||||
|
||||
@item
|
||||
Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
@item
|
||||
If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
@item
|
||||
Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
@end enumerate
|
||||
|
||||
For an executable, the required form of the ``work that uses the
|
||||
Library'' must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies the
|
||||
executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
@item
|
||||
You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
@item
|
||||
Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
@item
|
||||
You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
@item
|
||||
Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
@item
|
||||
If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
@item
|
||||
If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
@item
|
||||
The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
``any later version'', you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
@item
|
||||
If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
@iftex
|
||||
@heading NO WARRANTY
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center NO WARRANTY
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY ``AS IS'' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
@item
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
@end enumerate
|
||||
|
||||
@iftex
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center END OF TERMS AND CONDITIONS
|
||||
@end ifinfo
|
||||
|
||||
@page
|
||||
@appendixsubsec How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
``copyright'' line and a pointer to where the full notice is found.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the library's name and an idea of what it does.}
|
||||
Copyright (C) @var{year} @var{name of author}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
@end smallexample
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a ``copyright disclaimer'' for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
@smallexample
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the library
|
||||
`Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
@var{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
@end smallexample
|
||||
|
||||
That's all there is to it!
|
133
tags/gpgme-1.1.5/doc/mdate-sh
Executable file
133
tags/gpgme-1.1.5/doc/mdate-sh
Executable file
@ -0,0 +1,133 @@
|
||||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
# Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
|
||||
#
|
||||
# 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.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
save_arg1="$1"
|
||||
|
||||
# Find out how to get the extended ls output of a file or directory.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command='ls -L -l -d'
|
||||
else
|
||||
ls_command='ls -l -d'
|
||||
fi
|
||||
|
||||
# A `ls -l' line looks as follows on OS/2.
|
||||
# drwxrwx--- 0 Aug 11 2001 foo
|
||||
# This differs from Unix, which adds ownership information.
|
||||
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
|
||||
#
|
||||
# To find the date, we split the line on spaces and iterate on words
|
||||
# until we find a month. This cannot work with files whose owner is a
|
||||
# user named `Jan', or `Feb', etc. However, it's unlikely that `/'
|
||||
# will be owned by a user whose name is a month. So we first look at
|
||||
# the extended ls output of the root directory to decide how many
|
||||
# words should be skipped to get the date.
|
||||
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
set - x`$ls_command /`
|
||||
|
||||
# Find which argument is the month.
|
||||
month=
|
||||
command=
|
||||
until test $month
|
||||
do
|
||||
shift
|
||||
# Add another shift to the command.
|
||||
command="$command shift;"
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
set - x`eval "$ls_command \"\$save_arg1\""`
|
||||
|
||||
# Remove all preceding arguments
|
||||
eval $command
|
||||
|
||||
# Get the month. Next argument is day, followed by the year or time.
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
|
||||
day=$2
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
6773
tags/gpgme-1.1.5/doc/texinfo.tex
Normal file
6773
tags/gpgme-1.1.5/doc/texinfo.tex
Normal file
File diff suppressed because it is too large
Load Diff
67
tags/gpgme-1.1.5/gpgme.spec.in
Normal file
67
tags/gpgme-1.1.5/gpgme.spec.in
Normal file
@ -0,0 +1,67 @@
|
||||
# This is a template. The dist target uses it to create the real file.
|
||||
Summary: GPGME - GnuPG Made Easy
|
||||
Name: gpgme
|
||||
Version: @pkg_version@
|
||||
Release: 1
|
||||
URL: http://www.gnupg.org/gpgme.html
|
||||
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
|
||||
Group: Development/Libraries
|
||||
Copyright: GPL
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}
|
||||
BuildRequires: make
|
||||
Prereq: /sbin/ldconfig /sbin/install-info
|
||||
Requires: gnupg
|
||||
|
||||
%description
|
||||
GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG easier
|
||||
for applications. It provides a High-Level Crypto API for encryption,
|
||||
decryption, signing, signature verification and key management.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
|
||||
%install
|
||||
rm -fr $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT
|
||||
make install prefix=$RPM_BUILD_ROOT/usr infodir=$RPM_BUILD_ROOT%{_infodir}
|
||||
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
|
||||
%clean
|
||||
rm -fr $RPM_BUILD_ROOT
|
||||
make distclean
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
/sbin/install-info %{_infodir}/gpgme.info.gz %{_infodir}/dir
|
||||
|
||||
%preun
|
||||
if [ "$1" = 0 ]; then
|
||||
/sbin/install-info --delete %{_infodir}/gpgme.info.gz %{_infodir}/dir
|
||||
fi
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING COPYING.LESSER AUTHORS README INSTALL NEWS ChangeLog TODO THANKS
|
||||
%attr(0755,root,root) %{_bindir}/gpgme-config
|
||||
%attr(0755,root,root) %{_libdir}/*gpgme.so*
|
||||
%attr(0755,root,root) %{_libdir}/*gpgme.la
|
||||
%attr(0644,root,root) %{_libdir}/*gpgme.a
|
||||
%{_includedir}/gpgme.h
|
||||
%{_datadir}/aclocal/gpgme.m4
|
||||
%{_infodir}/gpgme.info*
|
||||
|
||||
%changelog
|
||||
* Sat Aug 30 2003 Robert Schiele <rschiele@uni-mannheim.de>
|
||||
- %{_infodir}/dir is not packaged, remove to prevent checking failure
|
||||
* Mon Jul 01 2002 Wojciech Polak <polak@lodz.pdi.net>
|
||||
- initial specfile release for GPGME.
|
||||
|
||||
# EOF
|
90
tags/gpgme-1.1.5/gpgme.txt
Normal file
90
tags/gpgme-1.1.5/gpgme.txt
Normal file
@ -0,0 +1,90 @@
|
||||
%%comments:
|
||||
Copyright (C) 2001, 2004 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
|
||||
Texts. A copy of the license is included in the file COPYING.
|
||||
|
||||
%%name: GPGME
|
||||
|
||||
%%short-description: GnuPG Made Easy
|
||||
|
||||
%%full-description: GPGME is a library designed to make access to
|
||||
GnuPG easier for applications. It provides a high-level crypto API
|
||||
for encryption, decryption, signing, signature verification and key
|
||||
management. Currently it uses GnuPG and GpgSM as its backends to
|
||||
support OpenPGP and the Cryptographic Message Syntax.
|
||||
|
||||
%%category: security, libraries
|
||||
|
||||
%%license: GPL
|
||||
%%license verified by:
|
||||
%%license verified on:
|
||||
|
||||
%%maintainer: g10 Code GmbH <gpgme@g10code.com>
|
||||
|
||||
%%updated: 2004-09-30
|
||||
|
||||
%%keywords: encryption, public key, digital signature, GnuPG
|
||||
|
||||
%%interface:
|
||||
|
||||
%%programs:
|
||||
|
||||
%%GNU: no
|
||||
|
||||
%%web-page: http://www.gnupg.org/gpgme.html
|
||||
|
||||
%%support: paid extension/consulting from http://www.g10code.com
|
||||
|
||||
%%doc: English programmer reference in Texinfo, Postscript, HTML included
|
||||
|
||||
%%developers: Werner Koch <wk@gnupg.org>.
|
||||
|
||||
%%contributors:
|
||||
|
||||
%%sponsors:
|
||||
|
||||
%%source: ftp://ftp.gnupg.org/gcrypt/gpgme/
|
||||
|
||||
%%debian:
|
||||
|
||||
%%redhat:
|
||||
|
||||
%%repository: See http://www.gnupg.org/cvs-access.html
|
||||
|
||||
%%related:
|
||||
|
||||
%%source-language: C
|
||||
|
||||
%%supported-languages: C, C++
|
||||
|
||||
%%use-requirements: GnuPG 1.2.2, GpgSM 1.9.6
|
||||
|
||||
%%build-prerequisites: libgpg-error 0.5
|
||||
|
||||
%%weak-prerequisites: Pth 1.2.0
|
||||
|
||||
%%source-prerequisites:
|
||||
|
||||
%%version: 1.0.0 released on 2004-09-30
|
||||
|
||||
%%announce-list: announce@gnupg.org announce-request@gnupg.org
|
||||
|
||||
%%announce-news:
|
||||
|
||||
%%help-list:
|
||||
|
||||
%%help-news:
|
||||
|
||||
%%dev-list: gnupg-devel@gnupg.org gnupg-devel-request@gnupg.org
|
||||
|
||||
%%dev-news:
|
||||
|
||||
%%bug-list:
|
||||
|
||||
%%bug-database:
|
||||
|
||||
%%entry written by: Werner Koch <wk@gnupg.org>
|
5323
tags/gpgme-1.1.5/gpgme/ChangeLog
Normal file
5323
tags/gpgme-1.1.5/gpgme/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
187
tags/gpgme-1.1.5/gpgme/Makefile.am
Normal file
187
tags/gpgme-1.1.5/gpgme/Makefile.am
Normal file
@ -0,0 +1,187 @@
|
||||
# Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
# Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||
#
|
||||
# This file is part of GPGME.
|
||||
#
|
||||
# GPGME is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# GPGME is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = gpgme-config.in gpgme.m4 mkstatus libgpgme.vers \
|
||||
versioninfo.rc.in gpgme.def
|
||||
BUILT_SOURCES = status-table.h
|
||||
MOSTLYCLEANFILES = status-table.h
|
||||
bin_SCRIPTS = gpgme-config
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = gpgme.m4
|
||||
include_HEADERS = gpgme.h
|
||||
|
||||
if HAVE_PTHREAD
|
||||
ltlib_gpgme_pthread = libgpgme-pthread.la
|
||||
else
|
||||
ltlib_gpgme_pthread =
|
||||
endif
|
||||
if HAVE_PTH
|
||||
ltlib_gpgme_pth = libgpgme-pth.la
|
||||
else
|
||||
ltlib_gpgme_pth =
|
||||
endif
|
||||
|
||||
if BUILD_W32_GLIB
|
||||
ltlib_gpgme_extra = libgpgme-glib.la
|
||||
else
|
||||
ltlib_gpgme_extra =
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_extra) \
|
||||
$(ltlib_gpgme_pthread) $(ltlib_gpgme_pth)
|
||||
|
||||
if HAVE_LD_VERSION_SCRIPT
|
||||
libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers
|
||||
else
|
||||
libgpgme_version_script_cmd =
|
||||
endif
|
||||
|
||||
if BUILD_ASSUAN
|
||||
assuan_cppflags = -I$(top_srcdir)/assuan
|
||||
assuan_libobjs = ../assuan/libassuan.la
|
||||
else
|
||||
assuan_cppflags =
|
||||
assuan_libobjs =
|
||||
endif
|
||||
|
||||
if HAVE_DOSISH_SYSTEM
|
||||
system_components = w32-util.c w32-sema.c
|
||||
system_components_not_extra = w32-io.c
|
||||
else
|
||||
system_components = ath.h posix-util.c posix-sema.c posix-io.c
|
||||
system_components_not_extra =
|
||||
endif
|
||||
|
||||
if HAVE_GPGSM
|
||||
gpgsm_components = engine-gpgsm.c
|
||||
else
|
||||
gpgsm_components =
|
||||
endif
|
||||
|
||||
# These are the source files common to all library versions. We used
|
||||
# to build a non-installed library for that, but that does not work
|
||||
# correctly on all platforms (in particular, one can not specify the
|
||||
# right linking order with libtool, as the non-installed version has
|
||||
# unresolved symbols to the thread module.
|
||||
main_sources = \
|
||||
gpgme.h util.h conversion.c get-env.c context.h ops.h \
|
||||
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
|
||||
data-compat.c \
|
||||
signers.c sig-notation.c \
|
||||
wait.c wait-global.c wait-private.c wait-user.c wait.h \
|
||||
op-support.c \
|
||||
encrypt.c encrypt-sign.c decrypt.c decrypt-verify.c verify.c \
|
||||
sign.c passphrase.c progress.c \
|
||||
key.c keylist.c trust-item.c trustlist.c \
|
||||
import.c export.c genkey.c delete.c edit.c \
|
||||
engine.h engine-backend.h engine.c rungpg.c status-table.h \
|
||||
$(gpgsm_components) sema.h priv-io.h $(system_components) \
|
||||
debug.c debug.h gpgme.c version.c error.c
|
||||
|
||||
libgpgme_la_SOURCES = $(main_sources) \
|
||||
ath.h ath.c $(system_components_not_extra)
|
||||
libgpgme_pthread_la_SOURCES = $(main_sources) \
|
||||
ath.h ath-pthread.c $(system_components_not_extra)
|
||||
libgpgme_pth_la_SOURCES = $(main_sources) \
|
||||
ath.h ath-pth.c $(system_components_not_extra)
|
||||
|
||||
if BUILD_W32_GLIB
|
||||
libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c
|
||||
endif
|
||||
|
||||
# We use a global CFLAGS and CPPFLAGS setting for all library
|
||||
# versions, because then every object file is only compiled once.
|
||||
AM_CPPFLAGS = $(assuan_cppflags) @GPG_ERROR_CFLAGS@ @PTH_CPPFLAGS@
|
||||
AM_CFLAGS = @PTH_CFLAGS@ @GLIB_CFLAGS@
|
||||
|
||||
if HAVE_W32_SYSTEM
|
||||
|
||||
LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
|
||||
`echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
|
||||
sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
|
||||
|
||||
%.lo : %.rc
|
||||
$(LTRCCOMPILE) -i $< -o $@
|
||||
|
||||
gpgme_res = versioninfo.lo
|
||||
gpgme_res_ldflag = -Wl,.libs/versioninfo.o
|
||||
|
||||
no_undefined = -no-undefined
|
||||
export_symbols = -export-symbols $(srcdir)/gpgme.def
|
||||
|
||||
install-def-file:
|
||||
$(INSTALL) $(srcdir)/gpgme.def $(DESTDIR)$(libdir)/gpgme.def
|
||||
|
||||
uninstall-def-file:
|
||||
-rm $(DESTDIR)$(libdir)/gpgme.def
|
||||
|
||||
gpgme_deps = $(gpgme_res) gpgme.def
|
||||
|
||||
else
|
||||
gpgme_res =
|
||||
gpgme_res_ldflag =
|
||||
no_undefined =
|
||||
export_symbols =
|
||||
install-def-file:
|
||||
uninstall-def-file:
|
||||
|
||||
gpgme_deps =
|
||||
endif
|
||||
|
||||
libgpgme_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) $(export_symbols) \
|
||||
$(libgpgme_version_script_cmd) -version-info \
|
||||
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
|
||||
libgpgme_la_DEPENDENCIES = $(assuan_libobjs) \
|
||||
@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
|
||||
libgpgme_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
|
||||
@GPG_ERROR_LIBS@ @NETLIBS@
|
||||
|
||||
libgpgme_pthread_la_LDFLAGS = $(libgpgme_version_script_cmd) -version-info \
|
||||
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
|
||||
libgpgme_pthread_la_DEPENDENCIES = $(assuan_libobjs) \
|
||||
@LTLIBOBJS@ $(srcdir)/libgpgme.vers
|
||||
libgpgme_pthread_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
|
||||
-lpthread @GPG_ERROR_LIBS@ @NETLIBS@
|
||||
|
||||
libgpgme_pth_la_LDFLAGS = @PTH_LDFLAGS@ \
|
||||
$(libgpgme_version_script_cmd) -version-info \
|
||||
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
|
||||
libgpgme_pth_la_DEPENDENCIES = $(assuan_libobjs) \
|
||||
@LTLIBOBJS@ $(srcdir)/libgpgme.vers
|
||||
libgpgme_pth_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
|
||||
@PTH_LIBS@ @GPG_ERROR_LIBS@ @NETLIBS@
|
||||
|
||||
if BUILD_W32_GLIB
|
||||
libgpgme_glib_la_LDFLAGS = $(gpgme_res_ldflag) $(no_undefined) \
|
||||
$(export_symbols) $(libgpgme_version_script_cmd) -version-info \
|
||||
@LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
|
||||
libgpgme_glib_la_DEPENDENCIES = $(assuan_libobjs) \
|
||||
@LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps)
|
||||
libgpgme_glib_la_LIBADD = $(assuan_libobjs) @LTLIBOBJS@ \
|
||||
@GPG_ERROR_LIBS@ @GLIB_LIBS@ @NETLIBS@
|
||||
endif
|
||||
|
||||
status-table.h : gpgme.h
|
||||
$(srcdir)/mkstatus < $(srcdir)/gpgme.h > status-table.h
|
||||
|
||||
install-data-local: install-def-file
|
||||
|
||||
uninstall-local: uninstall-def-file
|
178
tags/gpgme-1.1.5/gpgme/ath-pth.c
Normal file
178
tags/gpgme-1.1.5/gpgme/ath-pth.c
Normal file
@ -0,0 +1,178 @@
|
||||
/* ath-pth.c - Pth module for self-adapting thread-safeness library
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <pth.h>
|
||||
|
||||
#include "ath.h"
|
||||
|
||||
|
||||
/* The lock we take while checking for lazy lock initialization. */
|
||||
static pth_mutex_t check_init_lock = PTH_MUTEX_INIT;
|
||||
|
||||
/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if
|
||||
it is not already initialized. */
|
||||
static int
|
||||
mutex_pth_init (ath_mutex_t *priv, int just_check)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (just_check)
|
||||
pth_mutex_acquire (&check_init_lock, 0, NULL);
|
||||
if (!*priv || !just_check)
|
||||
{
|
||||
pth_mutex_t *lock = malloc (sizeof (pth_mutex_t));
|
||||
if (!lock)
|
||||
err = ENOMEM;
|
||||
if (!err)
|
||||
{
|
||||
err = pth_mutex_init (lock);
|
||||
if (err == FALSE)
|
||||
err = errno;
|
||||
else
|
||||
err = 0;
|
||||
|
||||
if (err)
|
||||
free (lock);
|
||||
else
|
||||
*priv = (ath_mutex_t) lock;
|
||||
}
|
||||
}
|
||||
if (just_check)
|
||||
pth_mutex_release (&check_init_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ath_init (void)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_init (ath_mutex_t *lock)
|
||||
{
|
||||
return mutex_pth_init (lock, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_destroy (ath_mutex_t *lock)
|
||||
{
|
||||
int err = mutex_pth_init (lock, 1);
|
||||
if (!err)
|
||||
{
|
||||
/* GNU Pth has no destructor function. */
|
||||
free (*lock);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_lock (ath_mutex_t *lock)
|
||||
{
|
||||
int ret = mutex_pth_init (lock, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pth_mutex_acquire ((pth_mutex_t *) *lock, 0, NULL);
|
||||
return ret == FALSE ? errno : 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_unlock (ath_mutex_t *lock)
|
||||
{
|
||||
int ret = mutex_pth_init (lock, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pth_mutex_release ((pth_mutex_t *) *lock);
|
||||
return ret == FALSE ? errno : 0;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_read (int fd, void *buf, size_t nbytes)
|
||||
{
|
||||
return pth_read (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_write (int fd, const void *buf, size_t nbytes)
|
||||
{
|
||||
return pth_write (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
return pth_select (nfd, rset, wset, eset, timeout);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_waitpid (pid_t pid, int *status, int options)
|
||||
{
|
||||
return pth_waitpid (pid, status, options);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr)
|
||||
{
|
||||
return pth_accept (s, addr, length_ptr);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_connect (int s, const struct sockaddr *addr, socklen_t length)
|
||||
{
|
||||
return pth_connect (s, addr, length);
|
||||
}
|
||||
|
||||
int
|
||||
ath_sendmsg (int s, const struct msghdr *msg, int flags)
|
||||
{
|
||||
/* FIXME: GNU Pth is missing pth_sendmsg. */
|
||||
return sendmsg (s, msg, flags);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_recvmsg (int s, struct msghdr *msg, int flags)
|
||||
{
|
||||
/* FIXME: GNU Pth is missing pth_recvmsg. */
|
||||
return recvmsg (s, msg, flags);
|
||||
}
|
||||
|
175
tags/gpgme-1.1.5/gpgme/ath-pthread.c
Normal file
175
tags/gpgme-1.1.5/gpgme/ath-pthread.c
Normal file
@ -0,0 +1,175 @@
|
||||
/* ath-pthread.c - pthread module for self-adapting thread-safeness library
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "ath.h"
|
||||
|
||||
|
||||
/* The lock we take while checking for lazy lock initialization. */
|
||||
static pthread_mutex_t check_init_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if
|
||||
it is not already initialized. */
|
||||
static int
|
||||
mutex_pthread_init (ath_mutex_t *priv, int just_check)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (just_check)
|
||||
pthread_mutex_lock (&check_init_lock);
|
||||
if (!*priv || !just_check)
|
||||
{
|
||||
pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t));
|
||||
if (!lock)
|
||||
err = ENOMEM;
|
||||
if (!err)
|
||||
{
|
||||
err = pthread_mutex_init (lock, NULL);
|
||||
if (err)
|
||||
free (lock);
|
||||
else
|
||||
*priv = (ath_mutex_t) lock;
|
||||
}
|
||||
}
|
||||
if (just_check)
|
||||
pthread_mutex_unlock (&check_init_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ath_init (void)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_init (ath_mutex_t *lock)
|
||||
{
|
||||
return mutex_pthread_init (lock, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_destroy (ath_mutex_t *lock)
|
||||
{
|
||||
int err = mutex_pthread_init (lock, 1);
|
||||
if (!err)
|
||||
{
|
||||
err = pthread_mutex_destroy ((pthread_mutex_t *) *lock);
|
||||
free (*lock);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_lock (ath_mutex_t *lock)
|
||||
{
|
||||
int ret = mutex_pthread_init (lock, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return pthread_mutex_lock ((pthread_mutex_t *) *lock);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_unlock (ath_mutex_t *lock)
|
||||
{
|
||||
int ret = mutex_pthread_init (lock, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return pthread_mutex_unlock ((pthread_mutex_t *) *lock);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_read (int fd, void *buf, size_t nbytes)
|
||||
{
|
||||
return read (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_write (int fd, const void *buf, size_t nbytes)
|
||||
{
|
||||
return write (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
return select (nfd, rset, wset, eset, timeout);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_waitpid (pid_t pid, int *status, int options)
|
||||
{
|
||||
return waitpid (pid, status, options);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr)
|
||||
{
|
||||
return accept (s, addr, length_ptr);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_connect (int s, const struct sockaddr *addr, socklen_t length)
|
||||
{
|
||||
return connect (s, addr, length);
|
||||
}
|
||||
|
||||
int
|
||||
ath_sendmsg (int s, const struct msghdr *msg, int flags)
|
||||
{
|
||||
return sendmsg (s, msg, flags);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_recvmsg (int s, struct msghdr *msg, int flags)
|
||||
{
|
||||
return recvmsg (s, msg, flags);
|
||||
}
|
169
tags/gpgme-1.1.5/gpgme/ath.c
Normal file
169
tags/gpgme-1.1.5/gpgme/ath.c
Normal file
@ -0,0 +1,169 @@
|
||||
/* ath.c - Thread-safeness library.
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include "ath.h"
|
||||
|
||||
|
||||
#define MUTEX_UNLOCKED ((ath_mutex_t) 0)
|
||||
#define MUTEX_LOCKED ((ath_mutex_t) 1)
|
||||
#define MUTEX_DESTROYED ((ath_mutex_t) 2)
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_init (ath_mutex_t *lock)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
*lock = MUTEX_UNLOCKED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_destroy (ath_mutex_t *lock)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
assert (*lock == MUTEX_UNLOCKED);
|
||||
|
||||
*lock = MUTEX_DESTROYED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_lock (ath_mutex_t *lock)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
assert (*lock == MUTEX_UNLOCKED);
|
||||
|
||||
*lock = MUTEX_LOCKED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_mutex_unlock (ath_mutex_t *lock)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
assert (*lock == MUTEX_LOCKED);
|
||||
|
||||
*lock = MUTEX_UNLOCKED;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_read (int fd, void *buf, size_t nbytes)
|
||||
{
|
||||
return read (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_write (int fd, const void *buf, size_t nbytes)
|
||||
{
|
||||
return write (fd, buf, nbytes);
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return -1; /* Not supported. */
|
||||
#else
|
||||
return select (nfd, rset, wset, eset, timeout);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
ath_waitpid (pid_t pid, int *status, int options)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return -1; /* Not supported. */
|
||||
#else
|
||||
return waitpid (pid, status, options);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return -1; /* Not supported. */
|
||||
#else
|
||||
return accept (s, addr, length_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_connect (int s, const struct sockaddr *addr, socklen_t length)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return -1; /* Not supported. */
|
||||
#else
|
||||
return connect (s, addr, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_sendmsg (int s, const struct msghdr *msg, int flags)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return -1; /* Not supported. */
|
||||
#else
|
||||
return sendmsg (s, msg, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ath_recvmsg (int s, struct msghdr *msg, int flags)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
return -1; /* Not supported. */
|
||||
#else
|
||||
return recvmsg (s, msg, flags);
|
||||
#endif
|
||||
}
|
89
tags/gpgme-1.1.5/gpgme/ath.h
Normal file
89
tags/gpgme-1.1.5/gpgme/ath.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* ath.h - Interfaces for thread-safeness library.
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef ATH_H
|
||||
#define ATH_H
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* fixme: Check how we did it in libgcrypt. */
|
||||
struct msghdr { int dummy; };
|
||||
typedef int socklen_t;
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
|
||||
#else /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
# ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
# else
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
|
||||
|
||||
/* Define _ATH_EXT_SYM_PREFIX if you want to give all external symbols
|
||||
a prefix. */
|
||||
#define _ATH_EXT_SYM_PREFIX _gpgme_
|
||||
|
||||
#ifdef _ATH_EXT_SYM_PREFIX
|
||||
#define _ATH_PREFIX1(x,y) x ## y
|
||||
#define _ATH_PREFIX2(x,y) _ATH_PREFIX1(x,y)
|
||||
#define _ATH_PREFIX(x) _ATH_PREFIX2(_ATH_EXT_SYM_PREFIX,x)
|
||||
#define ath_mutex_init _ATH_PREFIX(ath_mutex_init)
|
||||
#define ath_mutex_destroy _ATH_PREFIX(ath_mutex_destroy)
|
||||
#define ath_mutex_lock _ATH_PREFIX(ath_mutex_lock)
|
||||
#define ath_mutex_unlock _ATH_PREFIX(ath_mutex_unlock)
|
||||
#define ath_read _ATH_PREFIX(ath_read)
|
||||
#define ath_write _ATH_PREFIX(ath_write)
|
||||
#define ath_select _ATH_PREFIX(ath_select)
|
||||
#define ath_waitpid _ATH_PREFIX(ath_waitpid)
|
||||
#define ath_connect _ATH_PREFIX(ath_connect)
|
||||
#define ath_accept _ATH_PREFIX(ath_accept)
|
||||
#define ath_sendmsg _ATH_PREFIX(ath_sendmsg)
|
||||
#define ath_recvmsg _ATH_PREFIX(ath_recvmsg)
|
||||
#endif
|
||||
|
||||
|
||||
typedef void *ath_mutex_t;
|
||||
#define ATH_MUTEX_INITIALIZER 0;
|
||||
|
||||
/* Functions for mutual exclusion. */
|
||||
int ath_mutex_init (ath_mutex_t *mutex);
|
||||
int ath_mutex_destroy (ath_mutex_t *mutex);
|
||||
int ath_mutex_lock (ath_mutex_t *mutex);
|
||||
int ath_mutex_unlock (ath_mutex_t *mutex);
|
||||
|
||||
/* Replacement for the POSIX functions, which can be used to allow
|
||||
other (user-level) threads to run. */
|
||||
ssize_t ath_read (int fd, void *buf, size_t nbytes);
|
||||
ssize_t ath_write (int fd, const void *buf, size_t nbytes);
|
||||
ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
|
||||
struct timeval *timeout);
|
||||
ssize_t ath_waitpid (pid_t pid, int *status, int options);
|
||||
int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr);
|
||||
int ath_connect (int s, const struct sockaddr *addr, socklen_t length);
|
||||
int ath_sendmsg (int s, const struct msghdr *msg, int flags);
|
||||
int ath_recvmsg (int s, struct msghdr *msg, int flags);
|
||||
|
||||
#endif /* ATH_H */
|
118
tags/gpgme-1.1.5/gpgme/context.h
Normal file
118
tags/gpgme-1.1.5/gpgme/context.h
Normal file
@ -0,0 +1,118 @@
|
||||
/* context.h - Definitions for a GPGME context.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef CONTEXT_H
|
||||
#define CONTEXT_H
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "engine.h"
|
||||
#include "wait.h"
|
||||
|
||||
|
||||
/* Operations might require to remember arbitrary information and data
|
||||
objects during invocations of the status handler. The
|
||||
ctx_op_data structure provides a generic framework to hook in
|
||||
such additional data. */
|
||||
typedef enum
|
||||
{
|
||||
OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
|
||||
OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
|
||||
OPDATA_VERIFY, OPDATA_TRUSTLIST
|
||||
} ctx_op_data_id_t;
|
||||
|
||||
|
||||
struct ctx_op_data
|
||||
{
|
||||
/* The next element in the linked list, or NULL if this is the last
|
||||
element. */
|
||||
struct ctx_op_data *next;
|
||||
|
||||
/* The type of the hook data, which can be used by a routine to
|
||||
lookup the hook data. */
|
||||
ctx_op_data_id_t type;
|
||||
|
||||
/* The function to release HOOK and all its associated resources.
|
||||
Can be NULL if no special dealllocation routine is necessary. */
|
||||
void (*cleanup) (void *hook);
|
||||
|
||||
/* The hook that points to the operation data. */
|
||||
void *hook;
|
||||
};
|
||||
typedef struct ctx_op_data *ctx_op_data_t;
|
||||
|
||||
|
||||
/* The context defines an environment in which crypto operations can
|
||||
be performed (sequentially). */
|
||||
struct gpgme_context
|
||||
{
|
||||
/* The engine info for this context. */
|
||||
gpgme_engine_info_t engine_info;
|
||||
|
||||
/* The protocol used by this context. */
|
||||
gpgme_protocol_t protocol;
|
||||
|
||||
/* The running engine process. */
|
||||
engine_t engine;
|
||||
|
||||
/* True if armor mode should be used. */
|
||||
unsigned int use_armor : 1;
|
||||
|
||||
/* True if text mode should be used. */
|
||||
unsigned int use_textmode : 1;
|
||||
|
||||
/* Flags for keylist mode. */
|
||||
gpgme_keylist_mode_t keylist_mode;
|
||||
|
||||
/* Number of certs to be included. */
|
||||
unsigned int include_certs;
|
||||
|
||||
/* The number of keys in signers. */
|
||||
unsigned int signers_len;
|
||||
|
||||
/* Size of the following array. */
|
||||
unsigned int signers_size;
|
||||
gpgme_key_t *signers;
|
||||
|
||||
/* The signature notations for this context. */
|
||||
gpgme_sig_notation_t sig_notations;
|
||||
|
||||
/* The locale for the pinentry. */
|
||||
char *lc_ctype;
|
||||
char *lc_messages;
|
||||
|
||||
/* The operation data hooked into the context. */
|
||||
ctx_op_data_t op_data;
|
||||
|
||||
/* The user provided passphrase callback and its hook value. */
|
||||
gpgme_passphrase_cb_t passphrase_cb;
|
||||
void *passphrase_cb_value;
|
||||
|
||||
/* The user provided progress callback and its hook value. */
|
||||
gpgme_progress_cb_t progress_cb;
|
||||
void *progress_cb_value;
|
||||
|
||||
/* A list of file descriptors in active use by the current
|
||||
operation. */
|
||||
struct fd_table fdt;
|
||||
struct gpgme_io_cbs io_cbs;
|
||||
};
|
||||
|
||||
#endif /* CONTEXT_H */
|
414
tags/gpgme-1.1.5/gpgme/conversion.c
Normal file
414
tags/gpgme-1.1.5/gpgme/conversion.c
Normal file
@ -0,0 +1,414 @@
|
||||
/* conversion.c - String conversion helper functions.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#define atoi_1(p) (*(p) - '0' )
|
||||
#define atoi_2(p) ((atoi_1(p) * 10) + atoi_1((p)+1))
|
||||
#define atoi_4(p) ((atoi_2(p) * 100) + atoi_2((p)+2))
|
||||
|
||||
|
||||
|
||||
/* Convert two hexadecimal digits from STR to the value they
|
||||
represent. Returns -1 if one of the characters is not a
|
||||
hexadecimal digit. */
|
||||
int
|
||||
_gpgme_hextobyte (const char *str)
|
||||
{
|
||||
int val = 0;
|
||||
int i;
|
||||
|
||||
#define NROFHEXDIGITS 2
|
||||
for (i = 0; i < NROFHEXDIGITS; i++)
|
||||
{
|
||||
if (*str >= '0' && *str <= '9')
|
||||
val += *str - '0';
|
||||
else if (*str >= 'A' && *str <= 'F')
|
||||
val += 10 + *str - 'A';
|
||||
else if (*str >= 'a' && *str <= 'f')
|
||||
val += 10 + *str - 'a';
|
||||
else
|
||||
return -1;
|
||||
if (i < NROFHEXDIGITS - 1)
|
||||
val *= 16;
|
||||
str++;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/* Decode the C formatted string SRC and store the result in the
|
||||
buffer *DESTP which is LEN bytes long. If LEN is zero, then a
|
||||
large enough buffer is allocated with malloc and *DESTP is set to
|
||||
the result. Currently, LEN is only used to specify if allocation
|
||||
is desired or not, the caller is expected to make sure that *DESTP
|
||||
is large enough if LEN is not zero. */
|
||||
gpgme_error_t
|
||||
_gpgme_decode_c_string (const char *src, char **destp, size_t len)
|
||||
{
|
||||
char *dest;
|
||||
|
||||
/* Set up the destination buffer. */
|
||||
if (len)
|
||||
{
|
||||
if (len < strlen (src) + 1)
|
||||
return gpg_error (GPG_ERR_INTERNAL);
|
||||
|
||||
dest = *destp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The converted string will never be larger than the original
|
||||
string. */
|
||||
dest = malloc (strlen (src) + 1);
|
||||
if (!dest)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
*destp = dest;
|
||||
}
|
||||
|
||||
/* Convert the string. */
|
||||
while (*src)
|
||||
{
|
||||
if (*src != '\\')
|
||||
{
|
||||
*(dest++) = *(src++);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (src[1])
|
||||
{
|
||||
#define DECODE_ONE(match,result) \
|
||||
case match: \
|
||||
src += 2; \
|
||||
*(dest++) = result; \
|
||||
break;
|
||||
|
||||
DECODE_ONE ('\'', '\'');
|
||||
DECODE_ONE ('\"', '\"');
|
||||
DECODE_ONE ('\?', '\?');
|
||||
DECODE_ONE ('\\', '\\');
|
||||
DECODE_ONE ('a', '\a');
|
||||
DECODE_ONE ('b', '\b');
|
||||
DECODE_ONE ('f', '\f');
|
||||
DECODE_ONE ('n', '\n');
|
||||
DECODE_ONE ('r', '\r');
|
||||
DECODE_ONE ('t', '\t');
|
||||
DECODE_ONE ('v', '\v');
|
||||
|
||||
case 'x':
|
||||
{
|
||||
int val = _gpgme_hextobyte (&src[2]);
|
||||
|
||||
if (val == -1)
|
||||
{
|
||||
/* Should not happen. */
|
||||
*(dest++) = *(src++);
|
||||
*(dest++) = *(src++);
|
||||
if (*src)
|
||||
*(dest++) = *(src++);
|
||||
if (*src)
|
||||
*(dest++) = *(src++);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!val)
|
||||
{
|
||||
/* A binary zero is not representable in a C
|
||||
string. */
|
||||
*(dest++) = '\\';
|
||||
*(dest++) = '0';
|
||||
}
|
||||
else
|
||||
*((unsigned char *) dest++) = val;
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Should not happen. */
|
||||
*(dest++) = *(src++);
|
||||
*(dest++) = *(src++);
|
||||
}
|
||||
}
|
||||
}
|
||||
*(dest++) = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Decode the percent escaped string SRC and store the result in the
|
||||
buffer *DESTP which is LEN bytes long. If LEN is zero, then a
|
||||
large enough buffer is allocated with malloc and *DESTP is set to
|
||||
the result. Currently, LEN is only used to specify if allocation
|
||||
is desired or not, the caller is expected to make sure that *DESTP
|
||||
is large enough if LEN is not zero. If BINARY is 1, then '\0'
|
||||
characters are allowed in the output. */
|
||||
gpgme_error_t
|
||||
_gpgme_decode_percent_string (const char *src, char **destp, size_t len,
|
||||
int binary)
|
||||
{
|
||||
char *dest;
|
||||
|
||||
/* Set up the destination buffer. */
|
||||
if (len)
|
||||
{
|
||||
if (len < strlen (src) + 1)
|
||||
return gpg_error (GPG_ERR_INTERNAL);
|
||||
|
||||
dest = *destp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The converted string will never be larger than the original
|
||||
string. */
|
||||
dest = malloc (strlen (src) + 1);
|
||||
if (!dest)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
*destp = dest;
|
||||
}
|
||||
|
||||
/* Convert the string. */
|
||||
while (*src)
|
||||
{
|
||||
if (*src != '%')
|
||||
{
|
||||
*(dest++) = *(src++);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
int val = _gpgme_hextobyte (&src[1]);
|
||||
|
||||
if (val == -1)
|
||||
{
|
||||
/* Should not happen. */
|
||||
*(dest++) = *(src++);
|
||||
if (*src)
|
||||
*(dest++) = *(src++);
|
||||
if (*src)
|
||||
*(dest++) = *(src++);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!val && !binary)
|
||||
{
|
||||
/* A binary zero is not representable in a C
|
||||
string. */
|
||||
*(dest++) = '\\';
|
||||
*(dest++) = '0';
|
||||
}
|
||||
else
|
||||
*((unsigned char *) dest++) = val;
|
||||
src += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
*(dest++) = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Parse the string TIMESTAMP into a time_t. The string may either be
|
||||
seconds since Epoch or in the ISO 8601 format like
|
||||
"20390815T143012". Returns 0 for an empty string or seconds since
|
||||
Epoch. Leading spaces are skipped. If ENDP is not NULL, it will
|
||||
point to the next non-parsed character in TIMESTRING. */
|
||||
time_t
|
||||
_gpgme_parse_timestamp (const char *timestamp, char **endp)
|
||||
{
|
||||
/* Need to skip leading spaces, because that is what strtoul does
|
||||
but not our ISO 8601 checking code. */
|
||||
while (*timestamp && *timestamp== ' ')
|
||||
timestamp++;
|
||||
if (!*timestamp)
|
||||
return 0;
|
||||
|
||||
if (strlen (timestamp) >= 15 && timestamp[8] == 'T')
|
||||
{
|
||||
struct tm buf;
|
||||
int year;
|
||||
|
||||
year = atoi_4 (timestamp);
|
||||
if (year < 1900)
|
||||
return (time_t)(-1);
|
||||
|
||||
/* Fixme: We would better use a configure test to see whether
|
||||
mktime can handle dates beyond 2038. */
|
||||
if (sizeof (time_t) <= 4 && year >= 2038)
|
||||
return (time_t)2145914603; /* 2037-12-31 23:23:23 */
|
||||
|
||||
memset (&buf, 0, sizeof buf);
|
||||
buf.tm_year = year - 1900;
|
||||
buf.tm_mon = atoi_2 (timestamp+4) - 1;
|
||||
buf.tm_mday = atoi_2 (timestamp+6);
|
||||
buf.tm_hour = atoi_2 (timestamp+9);
|
||||
buf.tm_min = atoi_2 (timestamp+11);
|
||||
buf.tm_sec = atoi_2 (timestamp+13);
|
||||
|
||||
if (endp)
|
||||
*endp = (char*)(timestamp + 15);
|
||||
#ifdef HAVE_TIMEGM
|
||||
return timegm (&buf);
|
||||
#else
|
||||
{
|
||||
time_t tim;
|
||||
|
||||
putenv ("TZ=UTC");
|
||||
tim = mktime (&buf);
|
||||
#ifdef __GNUC__
|
||||
#warning fixme: we must somehow reset TZ here. It is not threadsafe anyway.
|
||||
#endif
|
||||
return tim;
|
||||
}
|
||||
#endif /* !HAVE_TIMEGM */
|
||||
}
|
||||
else
|
||||
return (time_t)strtoul (timestamp, endp, 10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
char *name;
|
||||
gpgme_error_t err;
|
||||
} gnupg_errors[] =
|
||||
{
|
||||
{ "EOF", GPG_ERR_EOF },
|
||||
{ "No_Error", GPG_ERR_NO_ERROR },
|
||||
{ "General_Error", GPG_ERR_GENERAL },
|
||||
{ "Out_Of_Core", GPG_ERR_ENOMEM },
|
||||
{ "Invalid_Value", GPG_ERR_INV_VALUE },
|
||||
{ "IO_Error", GPG_ERR_GENERAL },
|
||||
{ "Resource_Limit", GPG_ERR_RESOURCE_LIMIT },
|
||||
{ "Internal_Error", GPG_ERR_INTERNAL },
|
||||
{ "Bad_Certificate", GPG_ERR_BAD_CERT },
|
||||
{ "Bad_Certificate_Chain", GPG_ERR_BAD_CERT_CHAIN},
|
||||
{ "Missing_Certificate", GPG_ERR_MISSING_CERT },
|
||||
{ "No_Data", GPG_ERR_NO_DATA },
|
||||
{ "Bad_Signature", GPG_ERR_BAD_SIGNATURE },
|
||||
{ "Not_Implemented", GPG_ERR_NOT_IMPLEMENTED },
|
||||
{ "Conflict", GPG_ERR_CONFLICT },
|
||||
{ "Bug", GPG_ERR_BUG },
|
||||
{ "Read_Error", GPG_ERR_GENERAL },
|
||||
{ "Write_Error", GPG_ERR_GENERAL },
|
||||
{ "Invalid_Line", GPG_ERR_GENERAL },
|
||||
{ "Incomplete_Line", GPG_ERR_INCOMPLETE_LINE },
|
||||
{ "Invalid_Response", GPG_ERR_INV_RESPONSE },
|
||||
{ "Agent_Error", GPG_ERR_AGENT },
|
||||
{ "No_Public_Key", GPG_ERR_NO_PUBKEY },
|
||||
{ "No_Secret_Key", GPG_ERR_NO_SECKEY },
|
||||
{ "File_Open_Error", GPG_ERR_GENERAL },
|
||||
{ "File_Create_Error", GPG_ERR_GENERAL },
|
||||
{ "File_Error", GPG_ERR_GENERAL },
|
||||
{ "Not_Supported", GPG_ERR_NOT_SUPPORTED },
|
||||
{ "Invalid_Data", GPG_ERR_INV_DATA },
|
||||
{ "Assuan_Server_Fault", GPG_ERR_ASSUAN_SERVER_FAULT },
|
||||
{ "Assuan_Error", GPG_ERR_ASSUAN },
|
||||
{ "Invalid_Session_Key", GPG_ERR_INV_SESSION_KEY },
|
||||
{ "Invalid_Sexp", GPG_ERR_INV_SEXP },
|
||||
{ "Unsupported_Algorithm", GPG_ERR_UNSUPPORTED_ALGORITHM },
|
||||
{ "No_PIN_Entry", GPG_ERR_NO_PIN_ENTRY },
|
||||
{ "PIN_Entry_Error", GPG_ERR_NO_PIN_ENTRY },
|
||||
{ "Bad_PIN", GPG_ERR_BAD_PIN },
|
||||
{ "Bad_Passphrase", GPG_ERR_BAD_PASSPHRASE },
|
||||
{ "Invalid_Name", GPG_ERR_INV_NAME },
|
||||
{ "Bad_Public_Key", GPG_ERR_BAD_PUBKEY },
|
||||
{ "Bad_Secret_Key", GPG_ERR_BAD_SECKEY },
|
||||
{ "Bad_Data", GPG_ERR_BAD_DATA },
|
||||
{ "Invalid_Parameter", GPG_ERR_INV_PARAMETER },
|
||||
{ "Tribute_to_D_A", GPG_ERR_TRIBUTE_TO_D_A },
|
||||
{ "No_Dirmngr", GPG_ERR_NO_DIRMNGR },
|
||||
{ "Dirmngr_Error", GPG_ERR_DIRMNGR },
|
||||
{ "Certificate_Revoked", GPG_ERR_CERT_REVOKED },
|
||||
{ "No_CRL_Known", GPG_ERR_NO_CRL_KNOWN },
|
||||
{ "CRL_Too_Old", GPG_ERR_CRL_TOO_OLD },
|
||||
{ "Line_Too_Long", GPG_ERR_LINE_TOO_LONG },
|
||||
{ "Not_Trusted", GPG_ERR_NOT_TRUSTED },
|
||||
{ "Canceled", GPG_ERR_CANCELED },
|
||||
{ "Bad_CA_Certificate", GPG_ERR_BAD_CA_CERT },
|
||||
{ "Certificate_Expired", GPG_ERR_CERT_EXPIRED },
|
||||
{ "Certificate_Too_Young", GPG_ERR_CERT_TOO_YOUNG },
|
||||
{ "Unsupported_Certificate", GPG_ERR_UNSUPPORTED_CERT },
|
||||
{ "Unknown_Sexp", GPG_ERR_UNKNOWN_SEXP },
|
||||
{ "Unsupported_Protection", GPG_ERR_UNSUPPORTED_PROTECTION },
|
||||
{ "Corrupted_Protection", GPG_ERR_CORRUPTED_PROTECTION },
|
||||
{ "Ambiguous_Name", GPG_ERR_AMBIGUOUS_NAME },
|
||||
{ "Card_Error", GPG_ERR_CARD },
|
||||
{ "Card_Reset", GPG_ERR_CARD_RESET },
|
||||
{ "Card_Removed", GPG_ERR_CARD_REMOVED },
|
||||
{ "Invalid_Card", GPG_ERR_INV_CARD },
|
||||
{ "Card_Not_Present", GPG_ERR_CARD_NOT_PRESENT },
|
||||
{ "No_PKCS15_App", GPG_ERR_NO_PKCS15_APP },
|
||||
{ "Not_Confirmed", GPG_ERR_NOT_CONFIRMED },
|
||||
{ "Configuration_Error", GPG_ERR_CONFIGURATION },
|
||||
{ "No_Policy_Match", GPG_ERR_NO_POLICY_MATCH },
|
||||
{ "Invalid_Index", GPG_ERR_INV_INDEX },
|
||||
{ "Invalid_Id", GPG_ERR_INV_ID },
|
||||
{ "No_Scdaemon", GPG_ERR_NO_SCDAEMON },
|
||||
{ "Scdaemon_Error", GPG_ERR_SCDAEMON },
|
||||
{ "Unsupported_Protocol", GPG_ERR_UNSUPPORTED_PROTOCOL },
|
||||
{ "Bad_PIN_Method", GPG_ERR_BAD_PIN_METHOD },
|
||||
{ "Card_Not_Initialized", GPG_ERR_CARD_NOT_INITIALIZED },
|
||||
{ "Unsupported_Operation", GPG_ERR_UNSUPPORTED_OPERATION },
|
||||
{ "Wrong_Key_Usage", GPG_ERR_WRONG_KEY_USAGE }
|
||||
};
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_map_gnupg_error (char *err)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Future version of GnuPG might return the error code directly, so
|
||||
we first test for a a numerical value and use that verbatim.
|
||||
Note that this numerical value might be followed by an
|
||||
underschore and the textual representation of the error code. */
|
||||
if (*err >= '0' && *err <= '9')
|
||||
return strtoul (err, NULL, 10);
|
||||
|
||||
/* Well, this is a token, use the mapping table to get the error.
|
||||
The drawback is that we won't receive an error source and have to
|
||||
use GPG as source. */
|
||||
for (i = 0; i < DIM (gnupg_errors); i++)
|
||||
if (!strcmp (gnupg_errors[i].name, err))
|
||||
return gpg_err_make (GPG_ERR_SOURCE_GPG, gnupg_errors[i].err);
|
||||
|
||||
return gpg_err_make (GPG_ERR_SOURCE_GPG, GPG_ERR_GENERAL);
|
||||
}
|
209
tags/gpgme-1.1.5/gpgme/data-compat.c
Normal file
209
tags/gpgme-1.1.5/gpgme/data-compat.c
Normal file
@ -0,0 +1,209 @@
|
||||
/* data-compat.c - Compatibility interfaces for data objects.
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
/* Create a new data buffer filled with LENGTH bytes starting from
|
||||
OFFSET within the file FNAME or stream STREAM (exactly one must be
|
||||
non-zero). */
|
||||
gpgme_error_t
|
||||
gpgme_data_new_from_filepart (gpgme_data_t *dh, const char *fname,
|
||||
FILE *stream, off_t offset, size_t length)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
char *buf = NULL;
|
||||
int res;
|
||||
|
||||
if (stream && fname)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (fname)
|
||||
stream = fopen (fname, "rb");
|
||||
if (!stream)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
#ifdef HAVE_FSEEKO
|
||||
res = fseeko (stream, offset, SEEK_SET);
|
||||
#else
|
||||
/* FIXME: Check for overflow, or at least bail at compilation. */
|
||||
res = fseek (stream, offset, SEEK_SET);
|
||||
#endif
|
||||
|
||||
if (res)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
if (fname)
|
||||
fclose (stream);
|
||||
return gpg_error_from_errno (saved_errno);
|
||||
}
|
||||
|
||||
buf = malloc (length);
|
||||
if (!buf)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
if (fname)
|
||||
fclose (stream);
|
||||
return gpg_error_from_errno (saved_errno);
|
||||
}
|
||||
|
||||
while (fread (buf, length, 1, stream) < 1
|
||||
&& ferror (stream) && errno == EINTR);
|
||||
if (ferror (stream))
|
||||
{
|
||||
int saved_errno = errno;
|
||||
if (buf)
|
||||
free (buf);
|
||||
if (fname)
|
||||
fclose (stream);
|
||||
return gpg_error_from_errno (saved_errno);
|
||||
}
|
||||
|
||||
if (fname)
|
||||
fclose (stream);
|
||||
|
||||
err = gpgme_data_new (dh);
|
||||
if (err)
|
||||
{
|
||||
if (buf)
|
||||
free (buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
(*dh)->data.mem.buffer = buf;
|
||||
(*dh)->data.mem.size = length;
|
||||
(*dh)->data.mem.length = length;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Create a new data buffer filled with the content of file FNAME.
|
||||
COPY must be non-zero (delayed reads are not supported yet). */
|
||||
gpgme_error_t
|
||||
gpgme_data_new_from_file (gpgme_data_t *dh, const char *fname, int copy)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
if (!fname || !copy)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (stat (fname, &statbuf) < 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
return gpgme_data_new_from_filepart (dh, fname, NULL, 0, statbuf.st_size);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
gpgme_error_to_errno (gpgme_error_t err)
|
||||
{
|
||||
int no = gpg_err_code_to_errno (err);
|
||||
|
||||
if (no)
|
||||
{
|
||||
errno = no;
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (gpg_err_code (err))
|
||||
{
|
||||
case GPG_ERR_EOF:
|
||||
return 0;
|
||||
case GPG_ERR_INV_VALUE:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
case GPG_ERR_NOT_SUPPORTED:
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
default:
|
||||
/* FIXME: Yeah, well. */
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
old_user_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||
{
|
||||
size_t amt;
|
||||
gpgme_error_t err = (*dh->data.old_user.cb) (dh->data.old_user.handle,
|
||||
buffer, size, &amt);
|
||||
if (err)
|
||||
return gpgme_error_to_errno (err);
|
||||
return amt;
|
||||
}
|
||||
|
||||
|
||||
static off_t
|
||||
old_user_seek (gpgme_data_t dh, off_t offset, int whence)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
if (whence != SEEK_SET || offset)
|
||||
return EINVAL;
|
||||
err = (*dh->data.old_user.cb) (dh->data.old_user.handle, NULL, 0, NULL);
|
||||
if (err)
|
||||
return gpgme_error_to_errno (err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct _gpgme_data_cbs old_user_cbs =
|
||||
{
|
||||
old_user_read,
|
||||
NULL,
|
||||
old_user_seek,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* Create a new data buffer which retrieves the data from the callback
|
||||
function READ_CB. */
|
||||
gpgme_error_t
|
||||
gpgme_data_new_with_read_cb (gpgme_data_t *dh,
|
||||
int (*read_cb) (void *, char *, size_t, size_t *),
|
||||
void *read_cb_value)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_data_new (dh, &old_user_cbs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
(*dh)->data.old_user.cb = read_cb;
|
||||
(*dh)->data.old_user.handle = read_cb_value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_data_rewind (gpgme_data_t dh)
|
||||
{
|
||||
return (gpgme_data_seek (dh, 0, SEEK_SET) == -1)
|
||||
? gpg_error_from_errno (errno) : 0;
|
||||
}
|
78
tags/gpgme-1.1.5/gpgme/data-fd.c
Normal file
78
tags/gpgme-1.1.5/gpgme/data-fd.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* data-fd.c - A file descripor based data object.
|
||||
Copyright (C) 2002, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "data.h"
|
||||
|
||||
|
||||
static ssize_t
|
||||
fd_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||
{
|
||||
return read (dh->data.fd, buffer, size);
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
fd_write (gpgme_data_t dh, const void *buffer, size_t size)
|
||||
{
|
||||
return write (dh->data.fd, buffer, size);
|
||||
}
|
||||
|
||||
|
||||
static off_t
|
||||
fd_seek (gpgme_data_t dh, off_t offset, int whence)
|
||||
{
|
||||
return lseek (dh->data.fd, offset, whence);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
fd_get_fd (gpgme_data_t dh)
|
||||
{
|
||||
return (dh->data.fd);
|
||||
}
|
||||
|
||||
|
||||
static struct _gpgme_data_cbs fd_cbs =
|
||||
{
|
||||
fd_read,
|
||||
fd_write,
|
||||
fd_seek,
|
||||
NULL,
|
||||
fd_get_fd
|
||||
};
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_data_new_from_fd (gpgme_data_t *dh, int fd)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_data_new (dh, &fd_cbs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
(*dh)->data.fd = fd;
|
||||
return 0;
|
||||
}
|
251
tags/gpgme-1.1.5/gpgme/data-mem.c
Normal file
251
tags/gpgme-1.1.5/gpgme/data-mem.c
Normal file
@ -0,0 +1,251 @@
|
||||
/* data-mem.c - A memory based data object.
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
static ssize_t
|
||||
mem_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||
{
|
||||
size_t amt = dh->data.mem.length - dh->data.mem.offset;
|
||||
const char *src;
|
||||
|
||||
if (!amt)
|
||||
return 0;
|
||||
|
||||
if (size < amt)
|
||||
amt = size;
|
||||
|
||||
src = dh->data.mem.buffer ? dh->data.mem.buffer : dh->data.mem.orig_buffer;
|
||||
memcpy (buffer, src + dh->data.mem.offset, amt);
|
||||
dh->data.mem.offset += amt;
|
||||
return amt;
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
mem_write (gpgme_data_t dh, const void *buffer, size_t size)
|
||||
{
|
||||
size_t unused;
|
||||
|
||||
if (!dh->data.mem.buffer && dh->data.mem.orig_buffer)
|
||||
{
|
||||
size_t new_size = dh->data.mem.size;
|
||||
char *new_buffer;
|
||||
|
||||
if (new_size < dh->data.mem.offset + size)
|
||||
new_size = dh->data.mem.offset + size;
|
||||
|
||||
new_buffer = malloc (new_size);
|
||||
if (!new_buffer)
|
||||
return -1;
|
||||
memcpy (new_buffer, dh->data.mem.orig_buffer, dh->data.mem.length);
|
||||
|
||||
dh->data.mem.buffer = new_buffer;
|
||||
dh->data.mem.size = new_size;
|
||||
}
|
||||
|
||||
unused = dh->data.mem.size - dh->data.mem.offset;
|
||||
if (unused < size)
|
||||
{
|
||||
/* Allocate a large enough buffer with exponential backoff. */
|
||||
#define INITIAL_ALLOC 512
|
||||
size_t new_size = dh->data.mem.size
|
||||
? (2 * dh->data.mem.size) : INITIAL_ALLOC;
|
||||
char *new_buffer;
|
||||
|
||||
if (new_size < dh->data.mem.offset + size)
|
||||
new_size = dh->data.mem.offset + size;
|
||||
|
||||
new_buffer = realloc (dh->data.mem.buffer, new_size);
|
||||
if (!new_buffer && new_size > dh->data.mem.offset + size)
|
||||
{
|
||||
/* Maybe we were too greedy, try again. */
|
||||
new_size = dh->data.mem.offset + size;
|
||||
new_buffer = realloc (dh->data.mem.buffer, new_size);
|
||||
}
|
||||
if (!new_buffer)
|
||||
return -1;
|
||||
dh->data.mem.buffer = new_buffer;
|
||||
dh->data.mem.size = new_size;
|
||||
}
|
||||
|
||||
memcpy (dh->data.mem.buffer + dh->data.mem.offset, buffer, size);
|
||||
dh->data.mem.offset += size;
|
||||
if (dh->data.mem.length < dh->data.mem.offset)
|
||||
dh->data.mem.length = dh->data.mem.offset;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
static off_t
|
||||
mem_seek (gpgme_data_t dh, off_t offset, int whence)
|
||||
{
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
if (offset < 0 || offset > dh->data.mem.length)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
dh->data.mem.offset = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
if ((offset > 0 && dh->data.mem.length - dh->data.mem.offset < offset)
|
||||
|| (offset < 0 && dh->data.mem.offset < -offset))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
dh->data.mem.offset += offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
if (offset > 0 || -offset > dh->data.mem.length)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
dh->data.mem.offset = dh->data.mem.length - offset;
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return dh->data.mem.offset;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mem_release (gpgme_data_t dh)
|
||||
{
|
||||
if (dh->data.mem.buffer)
|
||||
free (dh->data.mem.buffer);
|
||||
}
|
||||
|
||||
|
||||
static struct _gpgme_data_cbs mem_cbs =
|
||||
{
|
||||
mem_read,
|
||||
mem_write,
|
||||
mem_seek,
|
||||
mem_release,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* Create a new data buffer and return it in R_DH. */
|
||||
gpgme_error_t
|
||||
gpgme_data_new (gpgme_data_t *dh)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_data_new (dh, &mem_cbs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Create a new data buffer filled with SIZE bytes starting from
|
||||
BUFFER. If COPY is zero, copying is delayed until necessary, and
|
||||
the data is taken from the original location when needed. */
|
||||
gpgme_error_t
|
||||
gpgme_data_new_from_mem (gpgme_data_t *dh, const char *buffer,
|
||||
size_t size, int copy)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_data_new (dh, &mem_cbs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (copy)
|
||||
{
|
||||
char *bufcpy = malloc (size);
|
||||
if (!bufcpy)
|
||||
_gpgme_data_release (*dh);
|
||||
memcpy (bufcpy, buffer, size);
|
||||
(*dh)->data.mem.buffer = bufcpy;
|
||||
}
|
||||
else
|
||||
(*dh)->data.mem.orig_buffer = buffer;
|
||||
|
||||
(*dh)->data.mem.size = size;
|
||||
(*dh)->data.mem.length = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Destroy the data buffer DH and return a pointer to its content.
|
||||
The memory has be to released with gpgme_free() by the user. It's
|
||||
size is returned in R_LEN. */
|
||||
char *
|
||||
gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len)
|
||||
{
|
||||
char *str = NULL;
|
||||
|
||||
if (!dh || dh->cbs != &mem_cbs)
|
||||
{
|
||||
gpgme_data_release (dh);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
str = dh->data.mem.buffer;
|
||||
if (!str && dh->data.mem.orig_buffer)
|
||||
{
|
||||
str = malloc (dh->data.mem.length);
|
||||
if (!str)
|
||||
{
|
||||
gpgme_data_release (dh);
|
||||
return NULL;
|
||||
}
|
||||
memcpy (str, dh->data.mem.orig_buffer, dh->data.mem.length);
|
||||
}
|
||||
else
|
||||
/* Prevent mem_release from releasing the buffer memory. We must
|
||||
not fail from this point. */
|
||||
dh->data.mem.buffer = NULL;
|
||||
|
||||
if (r_len)
|
||||
*r_len = dh->data.mem.length;
|
||||
|
||||
gpgme_data_release (dh);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/* Release the memory returned by gpgme_data_release_and_get_mem(). */
|
||||
void
|
||||
gpgme_free (void *buffer)
|
||||
{
|
||||
if (buffer)
|
||||
free (buffer);
|
||||
}
|
||||
|
101
tags/gpgme-1.1.5/gpgme/data-stream.c
Normal file
101
tags/gpgme-1.1.5/gpgme/data-stream.c
Normal file
@ -0,0 +1,101 @@
|
||||
/* data-stream.c - A stream based data object.
|
||||
Copyright (C) 2002, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "data.h"
|
||||
|
||||
|
||||
static ssize_t
|
||||
stream_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||
{
|
||||
size_t amt = fread (buffer, 1, size, dh->data.stream);
|
||||
if (amt > 0)
|
||||
return amt;
|
||||
return ferror (dh->data.stream) ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
stream_write (gpgme_data_t dh, const void *buffer, size_t size)
|
||||
{
|
||||
size_t amt = fwrite (buffer, 1, size, dh->data.stream);
|
||||
if (amt > 0)
|
||||
return amt;
|
||||
return ferror (dh->data.stream) ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
static off_t
|
||||
stream_seek (gpgme_data_t dh, off_t offset, int whence)
|
||||
{
|
||||
int err;
|
||||
|
||||
#ifdef HAVE_FSEEKO
|
||||
err = fseeko (dh->data.stream, offset, whence);
|
||||
#else
|
||||
/* FIXME: Check for overflow, or at least bail at compilation. */
|
||||
err = fseek (dh->data.stream, offset, whence);
|
||||
#endif
|
||||
|
||||
if (err)
|
||||
return -1;
|
||||
|
||||
#ifdef HAVE_FSEEKO
|
||||
return ftello (dh->data.stream);
|
||||
#else
|
||||
return ftell (dh->data.stream);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
stream_get_fd (gpgme_data_t dh)
|
||||
{
|
||||
fflush (dh->data.stream);
|
||||
return fileno (dh->data.stream);
|
||||
}
|
||||
|
||||
|
||||
static struct _gpgme_data_cbs stream_cbs =
|
||||
{
|
||||
stream_read,
|
||||
stream_write,
|
||||
stream_seek,
|
||||
NULL,
|
||||
stream_get_fd
|
||||
};
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_data_new_from_stream (gpgme_data_t *dh, FILE *stream)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_data_new (dh, &stream_cbs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
(*dh)->data.stream = stream;
|
||||
return 0;
|
||||
}
|
89
tags/gpgme-1.1.5/gpgme/data-user.c
Normal file
89
tags/gpgme-1.1.5/gpgme/data-user.c
Normal file
@ -0,0 +1,89 @@
|
||||
/* data-user.c - A user callback based data object.
|
||||
Copyright (C) 2002, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "data.h"
|
||||
|
||||
|
||||
static ssize_t
|
||||
user_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||
{
|
||||
if (!dh->data.user.cbs->read)
|
||||
return EBADF;
|
||||
|
||||
return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size);
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
user_write (gpgme_data_t dh, const void *buffer, size_t size)
|
||||
{
|
||||
if (!dh->data.user.cbs->write)
|
||||
return EBADF;
|
||||
|
||||
return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size);
|
||||
}
|
||||
|
||||
|
||||
static off_t
|
||||
user_seek (gpgme_data_t dh, off_t offset, int whence)
|
||||
{
|
||||
if (!dh->data.user.cbs->seek)
|
||||
return EBADF;
|
||||
|
||||
return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
user_release (gpgme_data_t dh)
|
||||
{
|
||||
if (dh->data.user.cbs->release)
|
||||
(*dh->data.user.cbs->release) (dh->data.user.handle);
|
||||
}
|
||||
|
||||
|
||||
static struct _gpgme_data_cbs user_cbs =
|
||||
{
|
||||
user_read,
|
||||
user_write,
|
||||
user_seek,
|
||||
user_release,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_data_new_from_cbs (gpgme_data_t *dh, gpgme_data_cbs_t cbs, void *handle)
|
||||
{
|
||||
gpgme_error_t err = _gpgme_data_new (dh, &user_cbs);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
(*dh)->data.user.cbs = cbs;
|
||||
(*dh)->data.user.handle = handle;
|
||||
return 0;
|
||||
}
|
293
tags/gpgme-1.1.5/gpgme/data.c
Normal file
293
tags/gpgme-1.1.5/gpgme/data.c
Normal file
@ -0,0 +1,293 @@
|
||||
/* data.c - An abstraction for data objects.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "data.h"
|
||||
#include "util.h"
|
||||
#include "ops.h"
|
||||
#include "priv-io.h"
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_data_new (gpgme_data_t *r_dh, struct _gpgme_data_cbs *cbs)
|
||||
{
|
||||
gpgme_data_t dh;
|
||||
|
||||
if (!r_dh)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
*r_dh = NULL;
|
||||
dh = calloc (1, sizeof (*dh));
|
||||
if (!dh)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
dh->cbs = cbs;
|
||||
|
||||
*r_dh = dh;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gpgme_data_release (gpgme_data_t dh)
|
||||
{
|
||||
if (!dh)
|
||||
return;
|
||||
|
||||
if (dh->file_name)
|
||||
free (dh->file_name);
|
||||
free (dh);
|
||||
}
|
||||
|
||||
|
||||
/* Read up to SIZE bytes into buffer BUFFER from the data object with
|
||||
the handle DH. Return the number of characters read, 0 on EOF and
|
||||
-1 on error. If an error occurs, errno is set. */
|
||||
ssize_t
|
||||
gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||
{
|
||||
if (!dh)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!dh->cbs->read)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
return (*dh->cbs->read) (dh, buffer, size);
|
||||
}
|
||||
|
||||
|
||||
/* Write up to SIZE bytes from buffer BUFFER to the data object with
|
||||
the handle DH. Return the number of characters written, or -1 on
|
||||
error. If an error occurs, errno is set. */
|
||||
ssize_t
|
||||
gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
|
||||
{
|
||||
if (!dh)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!dh->cbs->write)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
return (*dh->cbs->write) (dh, buffer, size);
|
||||
}
|
||||
|
||||
|
||||
/* Set the current position from where the next read or write starts
|
||||
in the data object with the handle DH to OFFSET, relativ to
|
||||
WHENCE. */
|
||||
off_t
|
||||
gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence)
|
||||
{
|
||||
if (!dh)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (!dh->cbs->seek)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* For relative movement, we must take into account the actual
|
||||
position of the read counter. */
|
||||
if (whence == SEEK_CUR)
|
||||
offset -= dh->pending_len;
|
||||
|
||||
offset = (*dh->cbs->seek) (dh, offset, whence);
|
||||
if (offset >= 0)
|
||||
dh->pending_len = 0;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/* Release the data object with the handle DH. */
|
||||
void
|
||||
gpgme_data_release (gpgme_data_t dh)
|
||||
{
|
||||
if (!dh)
|
||||
return;
|
||||
|
||||
if (dh->cbs->release)
|
||||
(*dh->cbs->release) (dh);
|
||||
_gpgme_data_release (dh);
|
||||
}
|
||||
|
||||
|
||||
/* Get the current encoding meta information for the data object with
|
||||
handle DH. */
|
||||
gpgme_data_encoding_t
|
||||
gpgme_data_get_encoding (gpgme_data_t dh)
|
||||
{
|
||||
return dh ? dh->encoding : GPGME_DATA_ENCODING_NONE;
|
||||
}
|
||||
|
||||
|
||||
/* Set the encoding meta information for the data object with handle
|
||||
DH to ENC. */
|
||||
gpgme_error_t
|
||||
gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc)
|
||||
{
|
||||
if (!dh)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
if (enc < 0 || enc > GPGME_DATA_ENCODING_ARMOR)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
dh->encoding = enc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Set the file name associated with the data object with handle DH to
|
||||
FILE_NAME. */
|
||||
gpgme_error_t
|
||||
gpgme_data_set_file_name (gpgme_data_t dh, const char *file_name)
|
||||
{
|
||||
if (!dh)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (dh->file_name)
|
||||
free (dh->file_name);
|
||||
|
||||
if (file_name)
|
||||
{
|
||||
dh->file_name = strdup (file_name);
|
||||
if (!dh->file_name)
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
else
|
||||
dh->file_name = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the file name associated with the data object with handle DH,
|
||||
or NULL if there is none. */
|
||||
char *
|
||||
gpgme_data_get_file_name (gpgme_data_t dh)
|
||||
{
|
||||
if (!dh)
|
||||
return NULL;
|
||||
|
||||
return dh->file_name;
|
||||
}
|
||||
|
||||
|
||||
/* Functions to support the wait interface. */
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_data_inbound_handler (void *opaque, int fd)
|
||||
{
|
||||
gpgme_data_t dh = (gpgme_data_t) opaque;
|
||||
char buffer[BUFFER_SIZE];
|
||||
char *bufp = buffer;
|
||||
ssize_t buflen;
|
||||
|
||||
buflen = _gpgme_io_read (fd, buffer, BUFFER_SIZE);
|
||||
if (buflen < 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
if (buflen == 0)
|
||||
{
|
||||
_gpgme_io_close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
ssize_t amt = gpgme_data_write (dh, bufp, buflen);
|
||||
if (amt == 0 || (amt < 0 && errno != EINTR))
|
||||
return gpg_error_from_errno (errno);
|
||||
bufp += amt;
|
||||
buflen -= amt;
|
||||
}
|
||||
while (buflen > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_data_outbound_handler (void *opaque, int fd)
|
||||
{
|
||||
gpgme_data_t dh = (gpgme_data_t) opaque;
|
||||
ssize_t nwritten;
|
||||
|
||||
if (!dh->pending_len)
|
||||
{
|
||||
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
|
||||
if (amt < 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
if (amt == 0)
|
||||
{
|
||||
_gpgme_io_close (fd);
|
||||
return 0;
|
||||
}
|
||||
dh->pending_len = amt;
|
||||
}
|
||||
|
||||
nwritten = _gpgme_io_write (fd, dh->pending, dh->pending_len);
|
||||
if (nwritten == -1 && errno == EAGAIN)
|
||||
return 0;
|
||||
|
||||
if (nwritten == -1 && errno == EPIPE)
|
||||
{
|
||||
/* Not much we can do. The other end closed the pipe, but we
|
||||
still have data. This should only ever happen if the other
|
||||
end is going to tell us what happened on some other channel.
|
||||
Silently close our end. */
|
||||
_gpgme_io_close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nwritten <= 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
if (nwritten < dh->pending_len)
|
||||
memmove (dh->pending, dh->pending + nwritten, dh->pending_len - nwritten);
|
||||
dh->pending_len -= nwritten;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get the file descriptor associated with DH, if possible. Otherwise
|
||||
return -1. */
|
||||
int
|
||||
_gpgme_data_get_fd (gpgme_data_t dh)
|
||||
{
|
||||
if (!dh || !dh->cbs->get_fd)
|
||||
return -1;
|
||||
return (*dh->cbs->get_fd) (dh);
|
||||
}
|
132
tags/gpgme-1.1.5/gpgme/data.h
Normal file
132
tags/gpgme-1.1.5/gpgme/data.h
Normal file
@ -0,0 +1,132 @@
|
||||
/* data.h - Internal data object abstraction interface.
|
||||
Copyright (C) 2002, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef DATA_H
|
||||
#define DATA_H
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
|
||||
|
||||
/* Read up to SIZE bytes into buffer BUFFER from the data object with
|
||||
the handle DH. Return the number of characters read, 0 on EOF and
|
||||
-1 on error. If an error occurs, errno is set. */
|
||||
typedef ssize_t (*gpgme_data_read_cb) (gpgme_data_t dh, void *buffer,
|
||||
size_t size);
|
||||
|
||||
/* Write up to SIZE bytes from buffer BUFFER to the data object with
|
||||
the handle DH. Return the number of characters written, or -1 on
|
||||
error. If an error occurs, errno is set. */
|
||||
typedef ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh, const void *buffer,
|
||||
size_t size);
|
||||
|
||||
/* Set the current position from where the next read or write starts
|
||||
in the data object with the handle DH to OFFSET, relativ to
|
||||
WHENCE. */
|
||||
typedef off_t (*gpgme_data_seek_cb) (gpgme_data_t dh, off_t offset,
|
||||
int whence);
|
||||
|
||||
/* Release the data object with the handle DH. */
|
||||
typedef void (*gpgme_data_release_cb) (gpgme_data_t dh);
|
||||
|
||||
/* Get the FD associated with the handle DH, or -1. */
|
||||
typedef int (*gpgme_data_get_fd_cb) (gpgme_data_t dh);
|
||||
|
||||
struct _gpgme_data_cbs
|
||||
{
|
||||
gpgme_data_read_cb read;
|
||||
gpgme_data_write_cb write;
|
||||
gpgme_data_seek_cb seek;
|
||||
gpgme_data_release_cb release;
|
||||
gpgme_data_get_fd_cb get_fd;
|
||||
};
|
||||
|
||||
struct gpgme_data
|
||||
{
|
||||
struct _gpgme_data_cbs *cbs;
|
||||
gpgme_data_encoding_t encoding;
|
||||
|
||||
#ifdef PIPE_BUF
|
||||
#define BUFFER_SIZE PIPE_BUF
|
||||
#else
|
||||
#ifdef _POSIX_PIPE_BUF
|
||||
#define BUFFER_SIZE _POSIX_PIPE_BUF
|
||||
#else
|
||||
#define BUFFER_SIZE 512
|
||||
#endif
|
||||
#endif
|
||||
char pending[BUFFER_SIZE];
|
||||
int pending_len;
|
||||
|
||||
/* File name of the data object. */
|
||||
char *file_name;
|
||||
|
||||
union
|
||||
{
|
||||
/* For gpgme_data_new_from_fd. */
|
||||
int fd;
|
||||
|
||||
/* For gpgme_data_new_from_stream. */
|
||||
FILE *stream;
|
||||
|
||||
/* For gpgme_data_new_from_cbs. */
|
||||
struct
|
||||
{
|
||||
gpgme_data_cbs_t cbs;
|
||||
void *handle;
|
||||
} user;
|
||||
|
||||
/* For gpgme_data_new_from_mem. */
|
||||
struct
|
||||
{
|
||||
char *buffer;
|
||||
const char *orig_buffer;
|
||||
/* Allocated size of BUFFER. */
|
||||
size_t size;
|
||||
size_t length;
|
||||
off_t offset;
|
||||
} mem;
|
||||
|
||||
/* For gpgme_data_new_from_read_cb. */
|
||||
struct
|
||||
{
|
||||
int (*cb) (void *, char *, size_t, size_t *);
|
||||
void *handle;
|
||||
} old_user;
|
||||
} data;
|
||||
};
|
||||
|
||||
|
||||
gpgme_error_t _gpgme_data_new (gpgme_data_t *r_dh,
|
||||
struct _gpgme_data_cbs *cbs);
|
||||
|
||||
void _gpgme_data_release (gpgme_data_t dh);
|
||||
|
||||
/* Get the file descriptor associated with DH, if possible. Otherwise
|
||||
return -1. */
|
||||
int _gpgme_data_get_fd (gpgme_data_t dh);
|
||||
|
||||
#endif /* DATA_H */
|
221
tags/gpgme-1.1.5/gpgme/debug.c
Normal file
221
tags/gpgme-1.1.5/gpgme/debug.c
Normal file
@ -0,0 +1,221 @@
|
||||
/* debug.c - helpful output in desperate situations
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "sema.h"
|
||||
|
||||
|
||||
/* Lock to serialize initialization of the debug output subsystem and
|
||||
output of actual debug messages. */
|
||||
DEFINE_STATIC_LOCK (debug_lock);
|
||||
|
||||
/* The amount of detail requested by the user, per environment
|
||||
variable GPGME_DEBUG. */
|
||||
static int debug_level;
|
||||
|
||||
/* The output stream for the debug messages. */
|
||||
static FILE *errfp;
|
||||
|
||||
|
||||
/* Remove leading and trailing white spaces. */
|
||||
static char *
|
||||
trim_spaces (char *str)
|
||||
{
|
||||
char *string, *p, *mark;
|
||||
|
||||
string = str;
|
||||
/* Find first non space character. */
|
||||
for (p = string; *p && isspace (*(unsigned char *) p); p++)
|
||||
;
|
||||
/* Move characters. */
|
||||
for (mark = NULL; (*string = *p); string++, p++)
|
||||
if (isspace (*(unsigned char *) p))
|
||||
{
|
||||
if (!mark)
|
||||
mark = string;
|
||||
}
|
||||
else
|
||||
mark = NULL;
|
||||
if (mark)
|
||||
*mark = '\0'; /* Remove trailing spaces. */
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
debug_init (void)
|
||||
{
|
||||
static int initialized;
|
||||
|
||||
LOCK (debug_lock);
|
||||
if (!initialized)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
char *e;
|
||||
const char *s1, *s2;;
|
||||
|
||||
err = _gpgme_getenv ("GPGME_DEBUG", &e);
|
||||
if (err)
|
||||
{
|
||||
UNLOCK (debug_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
initialized = 1;
|
||||
errfp = stderr;
|
||||
if (e)
|
||||
{
|
||||
debug_level = atoi (e);
|
||||
s1 = strchr (e, PATHSEP_C);
|
||||
if (s1)
|
||||
{
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
if (getuid () == geteuid ())
|
||||
{
|
||||
#endif
|
||||
char *p;
|
||||
FILE *fp;
|
||||
|
||||
s1++;
|
||||
if (!(s2 = strchr (s1, PATHSEP_C)))
|
||||
s2 = s1 + strlen (s1);
|
||||
p = malloc (s2 - s1 + 1);
|
||||
if (p)
|
||||
{
|
||||
memcpy (p, s1, s2 - s1);
|
||||
p[s2-s1] = 0;
|
||||
trim_spaces (p);
|
||||
fp = fopen (p,"a");
|
||||
if (fp)
|
||||
{
|
||||
setvbuf (fp, NULL, _IOLBF, 0);
|
||||
errfp = fp;
|
||||
}
|
||||
free (p);
|
||||
}
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
}
|
||||
#endif
|
||||
}
|
||||
free (e);
|
||||
}
|
||||
|
||||
if (debug_level > 0)
|
||||
fprintf (errfp, "gpgme_debug: level=%d\n", debug_level);
|
||||
}
|
||||
UNLOCK (debug_lock);
|
||||
}
|
||||
|
||||
|
||||
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
|
||||
void
|
||||
_gpgme_debug (int level, const char *format, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
|
||||
debug_init ();
|
||||
if (debug_level < level)
|
||||
return;
|
||||
|
||||
va_start (arg_ptr, format);
|
||||
LOCK (debug_lock);
|
||||
vfprintf (errfp, format, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
if(format && *format && format[strlen (format) - 1] != '\n')
|
||||
putc ('\n', errfp);
|
||||
UNLOCK (debug_lock);
|
||||
fflush (errfp);
|
||||
}
|
||||
|
||||
|
||||
/* Start a new debug line in *LINE, logged at level LEVEL or higher,
|
||||
and starting with the formatted string FORMAT. */
|
||||
void
|
||||
_gpgme_debug_begin (void **line, int level, const char *format, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
|
||||
debug_init ();
|
||||
if (debug_level < level)
|
||||
{
|
||||
/* Disable logging of this line. */
|
||||
*line = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
va_start (arg_ptr, format);
|
||||
vasprintf ((char **) line, format, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
}
|
||||
|
||||
|
||||
/* Add the formatted string FORMAT to the debug line *LINE. */
|
||||
void
|
||||
_gpgme_debug_add (void **line, const char *format, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
char *toadd;
|
||||
char *result;
|
||||
|
||||
if (!*line)
|
||||
return;
|
||||
|
||||
va_start (arg_ptr, format);
|
||||
vasprintf (&toadd, format, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
asprintf (&result, "%s%s", *(char **) line, toadd);
|
||||
free (*line);
|
||||
free (toadd);
|
||||
*line = result;
|
||||
}
|
||||
|
||||
|
||||
/* Finish construction of *LINE and send it to the debug output
|
||||
stream. */
|
||||
void
|
||||
_gpgme_debug_end (void **line)
|
||||
{
|
||||
if (!*line)
|
||||
return;
|
||||
|
||||
/* The smallest possible level is 1, so force logging here by
|
||||
using that. */
|
||||
_gpgme_debug (1, "%s", *line);
|
||||
free (*line);
|
||||
*line = NULL;
|
||||
}
|
128
tags/gpgme-1.1.5/gpgme/debug.h
Normal file
128
tags/gpgme-1.1.5/gpgme/debug.h
Normal file
@ -0,0 +1,128 @@
|
||||
/* debug.h - interface to debugging functions
|
||||
Copyright (C) 2002, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Remove path components from filenames (i.e. __FILE__) for cleaner
|
||||
logs. */
|
||||
static inline const char *_gpgme_debug_srcname (const char *file)
|
||||
GPGME_GCC_A_PURE;
|
||||
|
||||
static inline const char *
|
||||
_gpgme_debug_srcname (const char *file)
|
||||
{
|
||||
const char *s = strrchr (file, '/');
|
||||
return s? s+1:file;
|
||||
}
|
||||
|
||||
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
|
||||
void _gpgme_debug (int level, const char *format, ...);
|
||||
|
||||
/* Start a new debug line in *LINE, logged at level LEVEL or higher,
|
||||
and starting with the formatted string FORMAT. */
|
||||
void _gpgme_debug_begin (void **helper, int level, const char *format, ...);
|
||||
|
||||
/* Add the formatted string FORMAT to the debug line *LINE. */
|
||||
void _gpgme_debug_add (void **helper, const char *format, ...);
|
||||
|
||||
/* Finish construction of *LINE and send it to the debug output
|
||||
stream. */
|
||||
void _gpgme_debug_end (void **helper);
|
||||
|
||||
/* Indirect stringification, requires __STDC__ to work. */
|
||||
#define STRINGIFY(v) #v
|
||||
#define XSTRINGIFY(v) STRINGIFY(v)
|
||||
|
||||
#if 0
|
||||
/* Only works in GNU. */
|
||||
#define DEBUG(fmt, arg...) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__) , ##arg)
|
||||
#define DEBUG_BEGIN(hlp, lvl, fmt, arg...) \
|
||||
_gpgme_debug_begin (&(hlp), lvl, "%s:%s: " fmt, __FILE__, \
|
||||
XSTRINGIFY (__LINE__) , ##arg)
|
||||
#define DEBUG_ADD(hlp, fmt, arg...) \
|
||||
_gpgme_debug_add (&(hlp), fmt , ##arg)
|
||||
#define DEBUG_END(hlp, fmt, arg...) \
|
||||
_gpgme_debug_add (&(hlp), fmt , ##arg); \
|
||||
_gpgme_debug_end (&(hlp))
|
||||
#elif 0
|
||||
/* Only works in C99. */
|
||||
#define DEBUG0(fmt) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__))
|
||||
#define DEBUG(fmt, ...) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, __FILE__, XSTRINGIFY (__LINE__), __VA_ARGS__)
|
||||
#define DEBUG_BEGIN(hlp, lvl, fmt) \
|
||||
_gpgme_debug_begin (&(hlp), lvl, "%s:%s: " fmt, __FILE__, \
|
||||
XSTRINGIFY (__LINE__))
|
||||
#define DEBUG_BEGINX(hlp, lvl, fmt, ...) \
|
||||
_gpgme_debug_begin (&(hlp), lvl, "%s:%s: " fmt, __FILE__, \
|
||||
XSTRINGIFY (__LINE__), __VA_ARGS__)
|
||||
#define DEBUG_ADD0(hlp, fmt) \
|
||||
_gpgme_debug_add (&(hlp), fmt)
|
||||
#define DEBUG_ADD(hlp, fmt, ...) \
|
||||
_gpgme_debug_add (&(hlp), fmt, __VA_ARGS__)
|
||||
#define DEBUG_END(hlp, fmt) \
|
||||
_gpgme_debug_add (&(hlp), fmt); \
|
||||
_gpgme_debug_end (&(hlp))
|
||||
#define DEBUG_ENDX(hlp, fmt, ...) \
|
||||
_gpgme_debug_add (&(hlp), fmt, __VA_ARGS__); \
|
||||
_gpgme_debug_end (&(hlp))
|
||||
#else
|
||||
/* This finally works everywhere, horror. */
|
||||
#define DEBUG0(fmt) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||
XSTRINGIFY (__LINE__))
|
||||
#define DEBUG1(fmt,a) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||
XSTRINGIFY (__LINE__), (a))
|
||||
#define DEBUG2(fmt,a,b) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||
XSTRINGIFY (__LINE__), (a), (b))
|
||||
#define DEBUG3(fmt,a,b,c) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||
XSTRINGIFY (__LINE__), (a), (b), (c))
|
||||
#define DEBUG4(fmt,a,b,c,d) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||
XSTRINGIFY (__LINE__), (a), (b), (c), (d))
|
||||
#define DEBUG5(fmt,a,b,c,d,e) \
|
||||
_gpgme_debug (1, "%s:%s: " fmt, _gpgme_debug_srcname (__FILE__), \
|
||||
XSTRINGIFY (__LINE__), (a), (b), (c), (d), (e))
|
||||
#define DEBUG_BEGIN(hlp,lvl,fmt) \
|
||||
_gpgme_debug_begin (&(hlp), lvl, "%s:%s: " fmt, \
|
||||
_gpgme_debug_srcname (__FILE__), XSTRINGIFY (__LINE__))
|
||||
#define DEBUG_ADD0(hlp,fmt) \
|
||||
_gpgme_debug_add (&(hlp), fmt)
|
||||
#define DEBUG_ADD1(hlp,fmt,a) \
|
||||
_gpgme_debug_add (&(hlp), fmt, (a))
|
||||
#define DEBUG_ADD2(hlp,fmt,a,b) \
|
||||
_gpgme_debug_add (&(hlp), fmt, (a), (b))
|
||||
#define DEBUG_ADD3(hlp,fmt,a,b,c) \
|
||||
_gpgme_debug_add (&(hlp), fmt, (a), (b), (c))
|
||||
#define DEBUG_END(hlp,fmt) \
|
||||
_gpgme_debug_add (&(hlp), fmt); \
|
||||
_gpgme_debug_end (&(hlp))
|
||||
#endif
|
||||
|
||||
#define DEBUG_ENABLED(hlp) (!!(hlp))
|
||||
|
||||
#endif /* DEBUG_H */
|
103
tags/gpgme-1.1.5/gpgme/decrypt-verify.c
Normal file
103
tags/gpgme-1.1.5/gpgme/decrypt-verify.c
Normal file
@ -0,0 +1,103 @@
|
||||
/* decrypt-verify.c - Decrypt and verify function.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
decrypt_verify_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_progress_status_handler (priv, code, args);
|
||||
if (!err)
|
||||
err = _gpgme_decrypt_status_handler (priv, code, args);
|
||||
if (!err)
|
||||
err = _gpgme_verify_status_handler (priv, code, args);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
decrypt_verify_start (gpgme_ctx_t ctx, int synchronous,
|
||||
gpgme_data_t cipher, gpgme_data_t plain)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_decrypt_init_result (ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_verify_init_result (ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!cipher)
|
||||
return gpg_error (GPG_ERR_NO_DATA);
|
||||
if (!plain)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine,
|
||||
decrypt_verify_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain);
|
||||
}
|
||||
|
||||
|
||||
/* Decrypt ciphertext CIPHER and make a signature verification within
|
||||
CTX and store the resulting plaintext in PLAIN. */
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
return decrypt_verify_start (ctx, 0, cipher, plain);
|
||||
}
|
||||
|
||||
|
||||
/* Decrypt ciphertext CIPHER and make a signature verification within
|
||||
CTX and store the resulting plaintext in PLAIN. */
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
gpgme_error_t err = decrypt_verify_start (ctx, 1, cipher, plain);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
340
tags/gpgme-1.1.5/gpgme/decrypt.c
Normal file
340
tags/gpgme-1.1.5/gpgme/decrypt.c
Normal file
@ -0,0 +1,340 @@
|
||||
/* decrypt.c - Decrypt function.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "util.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct _gpgme_op_decrypt_result result;
|
||||
|
||||
int okay;
|
||||
int failed;
|
||||
|
||||
/* A pointer to the next pointer of the last recipient in the list.
|
||||
This makes appending new invalid signers painless while
|
||||
preserving the order. */
|
||||
gpgme_recipient_t *last_recipient_p;
|
||||
} *op_data_t;
|
||||
|
||||
|
||||
static void
|
||||
release_op_data (void *hook)
|
||||
{
|
||||
op_data_t opd = (op_data_t) hook;
|
||||
|
||||
if (opd->result.unsupported_algorithm)
|
||||
free (opd->result.unsupported_algorithm);
|
||||
|
||||
if (opd->result.file_name)
|
||||
free (opd->result.file_name);
|
||||
}
|
||||
|
||||
|
||||
gpgme_decrypt_result_t
|
||||
gpgme_op_decrypt_result (gpgme_ctx_t ctx)
|
||||
{
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err || !opd)
|
||||
return NULL;
|
||||
|
||||
return &opd->result;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
parse_enc_to (char *args, gpgme_recipient_t *recp)
|
||||
{
|
||||
gpgme_recipient_t rec;
|
||||
char *tail;
|
||||
int i;
|
||||
|
||||
rec = malloc (sizeof (*rec));
|
||||
if (!rec)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
rec->next = NULL;
|
||||
rec->keyid = rec->_keyid;
|
||||
rec->status = 0;
|
||||
|
||||
for (i = 0; i < sizeof (rec->_keyid) - 1; i++)
|
||||
{
|
||||
if (args[i] == '\0' || args[i] == ' ')
|
||||
break;
|
||||
|
||||
rec->_keyid[i] = args[i];
|
||||
}
|
||||
rec->_keyid[i] = '\0';
|
||||
|
||||
args = &args[i];
|
||||
if (*args != '\0' && *args != ' ')
|
||||
{
|
||||
free (rec);
|
||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
||||
}
|
||||
|
||||
while (*args == ' ')
|
||||
args++;
|
||||
|
||||
if (*args)
|
||||
{
|
||||
errno = 0;
|
||||
rec->pubkey_algo = strtol (args, &tail, 0);
|
||||
if (errno || args == tail || *tail != ' ')
|
||||
{
|
||||
/* The crypto backend does not behave. */
|
||||
free (rec);
|
||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: The key length is always 0 right now, so no need to parse
|
||||
it. */
|
||||
|
||||
*recp = rec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_passphrase_status_handler (priv, code, args);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case GPGME_STATUS_EOF:
|
||||
/* FIXME: These error values should probably be attributed to
|
||||
the underlying crypto engine (as error source). */
|
||||
if (opd->failed)
|
||||
return gpg_error (GPG_ERR_DECRYPT_FAILED);
|
||||
else if (!opd->okay)
|
||||
return gpg_error (GPG_ERR_NO_DATA);
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_DECRYPTION_OKAY:
|
||||
opd->okay = 1;
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_DECRYPTION_FAILED:
|
||||
opd->failed = 1;
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_ERROR:
|
||||
/* Note that this is an informational status code which should
|
||||
not lead to an error return unless it is something not
|
||||
related to the backend. */
|
||||
{
|
||||
const char d_alg[] = "decrypt.algorithm";
|
||||
const char u_alg[] = "Unsupported_Algorithm";
|
||||
const char k_alg[] = "decrypt.keyusage";
|
||||
|
||||
if (!strncmp (args, d_alg, sizeof (d_alg) - 1))
|
||||
{
|
||||
args += sizeof (d_alg) - 1;
|
||||
while (*args == ' ')
|
||||
args++;
|
||||
|
||||
if (!strncmp (args, u_alg, sizeof (u_alg) - 1))
|
||||
{
|
||||
char *end;
|
||||
|
||||
args += sizeof (u_alg) - 1;
|
||||
while (*args == ' ')
|
||||
args++;
|
||||
|
||||
end = strchr (args, ' ');
|
||||
if (end)
|
||||
*end = '\0';
|
||||
|
||||
if (!(*args == '?' && *(args + 1) == '\0'))
|
||||
{
|
||||
opd->result.unsupported_algorithm = strdup (args);
|
||||
if (!opd->result.unsupported_algorithm)
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strncmp (args, k_alg, sizeof (k_alg) - 1))
|
||||
{
|
||||
args += sizeof (k_alg) - 1;
|
||||
while (*args == ' ')
|
||||
args++;
|
||||
|
||||
err = _gpgme_map_gnupg_error (args);
|
||||
if (gpg_err_code (err) == GPG_ERR_WRONG_KEY_USAGE)
|
||||
opd->result.wrong_key_usage = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_ENC_TO:
|
||||
err = parse_enc_to (args, opd->last_recipient_p);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
opd->last_recipient_p = &(*opd->last_recipient_p)->next;
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_NO_SECKEY:
|
||||
{
|
||||
gpgme_recipient_t rec = opd->result.recipients;
|
||||
|
||||
while (rec)
|
||||
{
|
||||
if (!strcmp (rec->keyid, args))
|
||||
{
|
||||
rec->status = gpg_error (GPG_ERR_NO_SECKEY);
|
||||
break;
|
||||
}
|
||||
rec = rec->next;
|
||||
}
|
||||
/* FIXME: Is this ok? */
|
||||
if (!rec)
|
||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
||||
}
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_PLAINTEXT:
|
||||
err = _gpgme_parse_plaintext (args, &opd->result.file_name);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
decrypt_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_progress_status_handler (priv, code, args);
|
||||
if (!err)
|
||||
err = _gpgme_decrypt_status_handler (priv, code, args);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_op_decrypt_init_result (gpgme_ctx_t ctx)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_DECRYPT, &hook,
|
||||
sizeof (*opd), release_op_data);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
opd->last_recipient_p = &opd->result.recipients;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
decrypt_start (gpgme_ctx_t ctx, int synchronous,
|
||||
gpgme_data_t cipher, gpgme_data_t plain)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_decrypt_init_result (ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!cipher)
|
||||
return gpg_error (GPG_ERR_NO_DATA);
|
||||
if (!plain)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine, decrypt_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
return decrypt_start (ctx, 0, cipher, plain);
|
||||
}
|
||||
|
||||
|
||||
/* Decrypt ciphertext CIPHER within CTX and store the resulting
|
||||
plaintext in PLAIN. */
|
||||
gpgme_error_t
|
||||
gpgme_op_decrypt (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)
|
||||
{
|
||||
gpgme_error_t err = decrypt_start (ctx, 1, cipher, plain);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
109
tags/gpgme-1.1.5/gpgme/delete.c
Normal file
109
tags/gpgme-1.1.5/gpgme/delete.c
Normal file
@ -0,0 +1,109 @@
|
||||
/* delete.c - Delete a key.
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
delete_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
if (code == GPGME_STATUS_DELETE_PROBLEM)
|
||||
{
|
||||
enum delete_problem
|
||||
{
|
||||
DELETE_No_Problem = 0,
|
||||
DELETE_No_Such_Key = 1,
|
||||
DELETE_Must_Delete_Secret_Key = 2,
|
||||
DELETE_Ambiguous_Specification = 3
|
||||
};
|
||||
long problem;
|
||||
char *tail;
|
||||
|
||||
errno = 0;
|
||||
problem = strtol (args, &tail, 0);
|
||||
if (errno || (*tail && *tail != ' '))
|
||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
||||
|
||||
switch (problem)
|
||||
{
|
||||
case DELETE_No_Problem:
|
||||
break;
|
||||
|
||||
case DELETE_No_Such_Key:
|
||||
return gpg_error (GPG_ERR_NO_PUBKEY);
|
||||
|
||||
case DELETE_Must_Delete_Secret_Key:
|
||||
return gpg_error (GPG_ERR_CONFLICT);
|
||||
|
||||
case DELETE_Ambiguous_Specification:
|
||||
return gpg_error (GPG_ERR_AMBIGUOUS_NAME);
|
||||
|
||||
default:
|
||||
return gpg_error (GPG_ERR_GENERAL);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
delete_start (gpgme_ctx_t ctx, int synchronous, const gpgme_key_t key,
|
||||
int allow_secret)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine, delete_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_delete (ctx->engine, key, allow_secret);
|
||||
}
|
||||
|
||||
|
||||
/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret
|
||||
keys are also deleted. */
|
||||
gpgme_error_t
|
||||
gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
|
||||
int allow_secret)
|
||||
{
|
||||
return delete_start (ctx, 0, key, allow_secret);
|
||||
}
|
||||
|
||||
|
||||
/* Delete KEY from the keyring. If ALLOW_SECRET is non-zero, secret
|
||||
keys are also deleted. */
|
||||
gpgme_error_t
|
||||
gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, int allow_secret)
|
||||
{
|
||||
gpgme_error_t err = delete_start (ctx, 1, key, allow_secret);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
177
tags/gpgme-1.1.5/gpgme/edit.c
Normal file
177
tags/gpgme-1.1.5/gpgme/edit.c
Normal file
@ -0,0 +1,177 @@
|
||||
/* edit.c - Key edit function.
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* The user callback function and its hook value. */
|
||||
gpgme_edit_cb_t fnc;
|
||||
void *fnc_value;
|
||||
} *op_data_t;
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
edit_status_handler (void *priv, gpgme_status_code_t status, char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_passphrase_status_handler (priv, status, args);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_progress_status_handler (priv, status, args);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return (*opd->fnc) (opd->fnc_value, status, args, -1);
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
command_handler (void *priv, gpgme_status_code_t status, const char *args,
|
||||
int fd, int *processed_r)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
int processed = 0;
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_passphrase_command_handler (ctx, status, args,
|
||||
fd, &processed);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!processed)
|
||||
{
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* FIXME: We expect the user to handle _all_ status codes.
|
||||
Later, we may fix the callback interface to allow the user
|
||||
indicate if it processed the status code or not. */
|
||||
*processed_r = 1;
|
||||
|
||||
return (*opd->fnc) (opd->fnc_value, status, args, fd);
|
||||
}
|
||||
|
||||
*processed_r = processed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
edit_start (gpgme_ctx_t ctx, int synchronous, int type, gpgme_key_t key,
|
||||
gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!fnc || !out)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, sizeof (*opd), NULL);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
opd->fnc = fnc;
|
||||
opd->fnc_value = fnc_value;
|
||||
|
||||
err = _gpgme_engine_set_command_handler (ctx->engine, command_handler,
|
||||
ctx, out);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine, edit_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_edit (ctx->engine, type, key, out, ctx);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
|
||||
gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)
|
||||
{
|
||||
return edit_start (ctx, 0, 0, key, fnc, fnc_value, out);
|
||||
}
|
||||
|
||||
|
||||
/* Edit the key KEY. Send status and command requests to FNC and
|
||||
output of edit commands to OUT. */
|
||||
gpgme_error_t
|
||||
gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,
|
||||
gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)
|
||||
{
|
||||
gpgme_error_t err = edit_start (ctx, 1, 0, key, fnc, fnc_value, out);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
|
||||
gpgme_edit_cb_t fnc, void *fnc_value,
|
||||
gpgme_data_t out)
|
||||
{
|
||||
return edit_start (ctx, 0, 1, key, fnc, fnc_value, out);
|
||||
}
|
||||
|
||||
|
||||
/* Edit the card for the key KEY. Send status and command requests to
|
||||
FNC and output of edit commands to OUT. */
|
||||
gpgme_error_t
|
||||
gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key,
|
||||
gpgme_edit_cb_t fnc, void *fnc_value, gpgme_data_t out)
|
||||
{
|
||||
gpgme_error_t err = edit_start (ctx, 1, 1, key, fnc, fnc_value, out);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
110
tags/gpgme-1.1.5/gpgme/encrypt-sign.c
Normal file
110
tags/gpgme-1.1.5/gpgme/encrypt-sign.c
Normal file
@ -0,0 +1,110 @@
|
||||
/* encrypt-sign.c - encrypt and verify functions
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
encrypt_sign_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_progress_status_handler (priv, code, args);
|
||||
if (!err)
|
||||
err = _gpgme_encrypt_status_handler (priv, code, args);
|
||||
if (!err)
|
||||
err = _gpgme_sign_status_handler (priv, code, args);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
encrypt_sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!plain)
|
||||
return gpg_error (GPG_ERR_NO_DATA);
|
||||
if (!cipher || !recp)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
err = _gpgme_op_encrypt_init_result (ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_sign_init_result (ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine,
|
||||
encrypt_sign_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_encrypt_sign (ctx->engine, recp, flags, plain,
|
||||
cipher, ctx->use_armor,
|
||||
ctx /* FIXME */);
|
||||
}
|
||||
|
||||
|
||||
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
|
||||
store the resulting ciphertext in CIPHER. Also sign the ciphertext
|
||||
with the signers in CTX. */
|
||||
gpgme_error_t
|
||||
gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
return encrypt_sign_start (ctx, 0, recp, flags, plain, cipher);
|
||||
}
|
||||
|
||||
|
||||
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
|
||||
store the resulting ciphertext in CIPHER. Also sign the ciphertext
|
||||
with the signers in CTX. */
|
||||
gpgme_error_t
|
||||
gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
gpgme_error_t err = encrypt_sign_start (ctx, 1, recp, flags, plain, cipher);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
222
tags/gpgme-1.1.5/gpgme/encrypt.c
Normal file
222
tags/gpgme-1.1.5/gpgme/encrypt.c
Normal file
@ -0,0 +1,222 @@
|
||||
/* encrypt.c - Encrypt function.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct _gpgme_op_encrypt_result result;
|
||||
|
||||
/* A pointer to the next pointer of the last invalid recipient in
|
||||
the list. This makes appending new invalid recipients painless
|
||||
while preserving the order. */
|
||||
gpgme_invalid_key_t *lastp;
|
||||
} *op_data_t;
|
||||
|
||||
|
||||
static void
|
||||
release_op_data (void *hook)
|
||||
{
|
||||
op_data_t opd = (op_data_t) hook;
|
||||
gpgme_invalid_key_t invalid_recipient = opd->result.invalid_recipients;
|
||||
|
||||
while (invalid_recipient)
|
||||
{
|
||||
gpgme_invalid_key_t next = invalid_recipient->next;
|
||||
if (invalid_recipient->fpr)
|
||||
free (invalid_recipient->fpr);
|
||||
invalid_recipient = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gpgme_encrypt_result_t
|
||||
gpgme_op_encrypt_result (gpgme_ctx_t ctx)
|
||||
{
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
|
||||
if (err || !opd)
|
||||
return NULL;
|
||||
|
||||
return &opd->result;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_encrypt_status_handler (void *priv, gpgme_status_code_t code,
|
||||
char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case GPGME_STATUS_EOF:
|
||||
if (opd->result.invalid_recipients)
|
||||
return gpg_error (GPG_ERR_UNUSABLE_PUBKEY);
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_INV_RECP:
|
||||
err = _gpgme_parse_inv_recp (args, opd->lastp);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
opd->lastp = &(*opd->lastp)->next;
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_NO_RECP:
|
||||
/* Should not happen, because we require at least one recipient. */
|
||||
return gpg_error (GPG_ERR_GENERAL);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
encrypt_sym_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_progress_status_handler (priv, code, args);
|
||||
if (!err)
|
||||
err = _gpgme_passphrase_status_handler (priv, code, args);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
encrypt_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
return _gpgme_progress_status_handler (priv, code, args)
|
||||
|| _gpgme_encrypt_status_handler (priv, code, args);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_op_encrypt_init_result (gpgme_ctx_t ctx)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, sizeof (*opd),
|
||||
release_op_data);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
opd->lastp = &opd->result.invalid_recipients;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
encrypt_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
int symmetric = 0;
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_encrypt_init_result (ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!recp)
|
||||
symmetric = 1;
|
||||
|
||||
if (!plain)
|
||||
return gpg_error (GPG_ERR_NO_DATA);
|
||||
if (!cipher)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
if (recp && ! *recp)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (symmetric && ctx->passphrase_cb)
|
||||
{
|
||||
/* Symmetric encryption requires a passphrase. */
|
||||
err = _gpgme_engine_set_command_handler
|
||||
(ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine,
|
||||
symmetric
|
||||
? encrypt_sym_status_handler
|
||||
: encrypt_status_handler,
|
||||
ctx);
|
||||
|
||||
return _gpgme_engine_op_encrypt (ctx->engine, recp, flags, plain, cipher,
|
||||
ctx->use_armor);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
return encrypt_start (ctx, 0, recp, flags, plain, cipher);
|
||||
}
|
||||
|
||||
|
||||
/* Encrypt plaintext PLAIN within CTX for the recipients RECP and
|
||||
store the resulting ciphertext in CIPHER. */
|
||||
gpgme_error_t
|
||||
gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t cipher)
|
||||
{
|
||||
gpgme_error_t err = encrypt_start (ctx, 1, recp, flags, plain, cipher);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
110
tags/gpgme-1.1.5/gpgme/engine-backend.h
Normal file
110
tags/gpgme-1.1.5/gpgme/engine-backend.h
Normal file
@ -0,0 +1,110 @@
|
||||
/* engine-backend.h - A crypto backend for the engine interface.
|
||||
Copyright (C) 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef ENGINE_BACKEND_H
|
||||
#define ENGINE_BACKEND_H
|
||||
|
||||
#include "engine.h"
|
||||
|
||||
/* FIXME: Correct check? */
|
||||
#ifdef GPGSM_PATH
|
||||
#define ENABLE_GPGSM 1
|
||||
#endif
|
||||
|
||||
struct engine_ops
|
||||
{
|
||||
/* Static functions. */
|
||||
|
||||
/* Return the default file name for the binary of this engine. */
|
||||
const char *(*get_file_name) (void);
|
||||
|
||||
/* Returns a malloced string containing the version of the engine
|
||||
with the given binary file name (or the default if FILE_NAME is
|
||||
NULL. */
|
||||
char *(*get_version) (const char *file_name);
|
||||
|
||||
/* Returns a statically allocated string containing the required
|
||||
version. */
|
||||
const char *(*get_req_version) (void);
|
||||
|
||||
gpgme_error_t (*new) (void **r_engine,
|
||||
const char *file_name, const char *home_dir);
|
||||
|
||||
/* Member functions. */
|
||||
void (*release) (void *engine);
|
||||
gpgme_error_t (*reset) (void *engine);
|
||||
void (*set_status_handler) (void *engine, engine_status_handler_t fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t (*set_command_handler) (void *engine,
|
||||
engine_command_handler_t fnc,
|
||||
void *fnc_value, gpgme_data_t data);
|
||||
gpgme_error_t (*set_colon_line_handler) (void *engine,
|
||||
engine_colon_line_handler_t fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t (*set_locale) (void *engine, int category, const char *value);
|
||||
gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,
|
||||
gpgme_data_t plain);
|
||||
gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret);
|
||||
gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key,
|
||||
gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t (*encrypt) (void *engine, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor);
|
||||
gpgme_error_t (*encrypt_sign) (void *engine, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t (*export) (void *engine, const char *pattern,
|
||||
unsigned int reserved, gpgme_data_t keydata,
|
||||
int use_armor);
|
||||
gpgme_error_t (*export_ext) (void *engine, const char *pattern[],
|
||||
unsigned int reserved, gpgme_data_t keydata,
|
||||
int use_armor);
|
||||
gpgme_error_t (*genkey) (void *engine, gpgme_data_t help_data, int use_armor,
|
||||
gpgme_data_t pubkey, gpgme_data_t seckey);
|
||||
gpgme_error_t (*import) (void *engine, gpgme_data_t keydata);
|
||||
gpgme_error_t (*keylist) (void *engine, const char *pattern,
|
||||
int secret_only, gpgme_keylist_mode_t mode);
|
||||
gpgme_error_t (*keylist_ext) (void *engine, const char *pattern[],
|
||||
int secret_only, int reserved,
|
||||
gpgme_keylist_mode_t mode);
|
||||
gpgme_error_t (*sign) (void *engine, gpgme_data_t in, gpgme_data_t out,
|
||||
gpgme_sig_mode_t mode, int use_armor,
|
||||
int use_textmode,
|
||||
int include_certs, gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t (*trustlist) (void *engine, const char *pattern);
|
||||
gpgme_error_t (*verify) (void *engine, gpgme_data_t sig,
|
||||
gpgme_data_t signed_text,
|
||||
gpgme_data_t plaintext);
|
||||
|
||||
void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs);
|
||||
void (*io_event) (void *engine, gpgme_event_io_t type, void *type_data);
|
||||
|
||||
gpgme_error_t (*cancel) (void *engine);
|
||||
};
|
||||
|
||||
|
||||
extern struct engine_ops _gpgme_engine_ops_gpg; /* OpenPGP. */
|
||||
#ifdef ENABLE_GPGSM
|
||||
extern struct engine_ops _gpgme_engine_ops_gpgsm; /* CMS. */
|
||||
#endif
|
||||
|
||||
#endif /* ENGINE_BACKEND_H */
|
1749
tags/gpgme-1.1.5/gpgme/engine-gpgsm.c
Normal file
1749
tags/gpgme-1.1.5/gpgme/engine-gpgsm.c
Normal file
File diff suppressed because it is too large
Load Diff
744
tags/gpgme-1.1.5/gpgme/engine.c
Normal file
744
tags/gpgme-1.1.5/gpgme/engine.c
Normal file
@ -0,0 +1,744 @@
|
||||
/* engine.c - GPGME engine support.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2006 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "util.h"
|
||||
#include "sema.h"
|
||||
#include "ops.h"
|
||||
|
||||
#include "engine.h"
|
||||
#include "engine-backend.h"
|
||||
|
||||
|
||||
struct engine
|
||||
{
|
||||
struct engine_ops *ops;
|
||||
void *engine;
|
||||
};
|
||||
|
||||
|
||||
static struct engine_ops *engine_ops[] =
|
||||
{
|
||||
&_gpgme_engine_ops_gpg, /* OpenPGP. */
|
||||
#ifdef ENABLE_GPGSM
|
||||
&_gpgme_engine_ops_gpgsm /* CMS. */
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
/* The engine info. */
|
||||
static gpgme_engine_info_t engine_info;
|
||||
DEFINE_STATIC_LOCK (engine_info_lock);
|
||||
|
||||
|
||||
/* Get the file name of the engine for PROTOCOL. */
|
||||
static const char *
|
||||
engine_get_file_name (gpgme_protocol_t proto)
|
||||
{
|
||||
if (proto > DIM (engine_ops))
|
||||
return NULL;
|
||||
|
||||
if (engine_ops[proto] && engine_ops[proto]->get_file_name)
|
||||
return (*engine_ops[proto]->get_file_name) ();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Get a malloced string containing the version number of the engine
|
||||
for PROTOCOL. */
|
||||
static char *
|
||||
engine_get_version (gpgme_protocol_t proto, const char *file_name)
|
||||
{
|
||||
if (proto > DIM (engine_ops))
|
||||
return NULL;
|
||||
|
||||
if (engine_ops[proto] && engine_ops[proto]->get_version)
|
||||
return (*engine_ops[proto]->get_version) (file_name);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Get the required version number of the engine for PROTOCOL. */
|
||||
static const char *
|
||||
engine_get_req_version (gpgme_protocol_t proto)
|
||||
{
|
||||
if (proto > DIM (engine_ops))
|
||||
return NULL;
|
||||
|
||||
if (engine_ops[proto] && engine_ops[proto]->get_req_version)
|
||||
return (*engine_ops[proto]->get_req_version) ();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Verify the version requirement for the engine for PROTOCOL. */
|
||||
gpgme_error_t
|
||||
gpgme_engine_check_version (gpgme_protocol_t proto)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
gpgme_engine_info_t info;
|
||||
int result;
|
||||
|
||||
LOCK (engine_info_lock);
|
||||
info = engine_info;
|
||||
if (!info)
|
||||
{
|
||||
/* Make sure it is initialized. */
|
||||
UNLOCK (engine_info_lock);
|
||||
err = gpgme_get_engine_info (&info);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
LOCK (engine_info_lock);
|
||||
}
|
||||
|
||||
while (info && info->protocol != proto)
|
||||
info = info->next;
|
||||
|
||||
if (!info)
|
||||
result = 0;
|
||||
else
|
||||
result = _gpgme_compare_versions (info->version,
|
||||
info->req_version);
|
||||
|
||||
UNLOCK (engine_info_lock);
|
||||
return result ? 0 : gpg_error (GPG_ERR_INV_ENGINE);
|
||||
}
|
||||
|
||||
|
||||
/* Release the engine info INFO. */
|
||||
void
|
||||
_gpgme_engine_info_release (gpgme_engine_info_t info)
|
||||
{
|
||||
while (info)
|
||||
{
|
||||
gpgme_engine_info_t next_info = info->next;
|
||||
|
||||
assert (info->file_name);
|
||||
free (info->file_name);
|
||||
if (info->home_dir)
|
||||
free (info->home_dir);
|
||||
if (info->version)
|
||||
free (info->version);
|
||||
free (info);
|
||||
info = next_info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get the information about the configured and installed engines. A
|
||||
pointer to the first engine in the statically allocated linked list
|
||||
is returned in *INFO. If an error occurs, it is returned. The
|
||||
returned data is valid until the next gpgme_set_engine_info. */
|
||||
gpgme_error_t
|
||||
gpgme_get_engine_info (gpgme_engine_info_t *info)
|
||||
{
|
||||
LOCK (engine_info_lock);
|
||||
if (!engine_info)
|
||||
{
|
||||
gpgme_engine_info_t *lastp = &engine_info;
|
||||
gpgme_protocol_t proto_list[] = { GPGME_PROTOCOL_OpenPGP,
|
||||
GPGME_PROTOCOL_CMS };
|
||||
unsigned int proto;
|
||||
|
||||
for (proto = 0; proto < DIM (proto_list); proto++)
|
||||
{
|
||||
const char *ofile_name = engine_get_file_name (proto_list[proto]);
|
||||
char *file_name;
|
||||
|
||||
if (!ofile_name)
|
||||
continue;
|
||||
|
||||
file_name = strdup (ofile_name);
|
||||
|
||||
*lastp = malloc (sizeof (*engine_info));
|
||||
if (!*lastp || !file_name)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
|
||||
_gpgme_engine_info_release (engine_info);
|
||||
engine_info = NULL;
|
||||
|
||||
if (file_name)
|
||||
free (file_name);
|
||||
|
||||
UNLOCK (engine_info_lock);
|
||||
return gpg_error_from_errno (saved_errno);
|
||||
}
|
||||
|
||||
(*lastp)->protocol = proto_list[proto];
|
||||
(*lastp)->file_name = file_name;
|
||||
(*lastp)->home_dir = NULL;
|
||||
(*lastp)->version = engine_get_version (proto_list[proto], NULL);
|
||||
(*lastp)->req_version = engine_get_req_version (proto_list[proto]);
|
||||
(*lastp)->next = NULL;
|
||||
lastp = &(*lastp)->next;
|
||||
}
|
||||
}
|
||||
|
||||
*info = engine_info;
|
||||
UNLOCK (engine_info_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get a deep copy of the engine info and return it in INFO. */
|
||||
gpgme_error_t
|
||||
_gpgme_engine_info_copy (gpgme_engine_info_t *r_info)
|
||||
{
|
||||
gpgme_error_t err = 0;
|
||||
gpgme_engine_info_t info;
|
||||
gpgme_engine_info_t new_info;
|
||||
gpgme_engine_info_t *lastp;
|
||||
|
||||
LOCK (engine_info_lock);
|
||||
info = engine_info;
|
||||
if (!info)
|
||||
{
|
||||
/* Make sure it is initialized. */
|
||||
UNLOCK (engine_info_lock);
|
||||
err = gpgme_get_engine_info (&info);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
LOCK (engine_info_lock);
|
||||
}
|
||||
|
||||
new_info = NULL;
|
||||
lastp = &new_info;
|
||||
|
||||
while (info)
|
||||
{
|
||||
char *file_name;
|
||||
char *home_dir;
|
||||
char *version;
|
||||
|
||||
assert (info->file_name);
|
||||
file_name = strdup (info->file_name);
|
||||
|
||||
if (info->home_dir)
|
||||
{
|
||||
home_dir = strdup (info->home_dir);
|
||||
if (!home_dir)
|
||||
err = gpg_error_from_errno (errno);
|
||||
}
|
||||
else
|
||||
home_dir = NULL;
|
||||
|
||||
if (info->version)
|
||||
{
|
||||
version = strdup (info->version);
|
||||
if (!version)
|
||||
err = gpg_error_from_errno (errno);
|
||||
}
|
||||
else
|
||||
version = NULL;
|
||||
|
||||
*lastp = malloc (sizeof (*engine_info));
|
||||
if (!*lastp || !file_name || err)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
|
||||
_gpgme_engine_info_release (new_info);
|
||||
|
||||
if (file_name)
|
||||
free (file_name);
|
||||
if (home_dir)
|
||||
free (home_dir);
|
||||
if (version)
|
||||
free (version);
|
||||
|
||||
UNLOCK (engine_info_lock);
|
||||
return gpg_error_from_errno (saved_errno);
|
||||
}
|
||||
|
||||
(*lastp)->protocol = info->protocol;
|
||||
(*lastp)->file_name = file_name;
|
||||
(*lastp)->home_dir = home_dir;
|
||||
(*lastp)->version = version;
|
||||
(*lastp)->req_version = info->req_version;
|
||||
(*lastp)->next = NULL;
|
||||
lastp = &(*lastp)->next;
|
||||
|
||||
info = info->next;
|
||||
}
|
||||
|
||||
*r_info = new_info;
|
||||
UNLOCK (engine_info_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Set the engine info for the info list INFO, protocol PROTO, to the
|
||||
file name FILE_NAME and the home directory HOME_DIR. */
|
||||
gpgme_error_t
|
||||
_gpgme_set_engine_info (gpgme_engine_info_t info, gpgme_protocol_t proto,
|
||||
const char *file_name, const char *home_dir)
|
||||
{
|
||||
char *new_file_name;
|
||||
char *new_home_dir;
|
||||
|
||||
/* FIXME: Use some PROTO_MAX definition. */
|
||||
if (proto > DIM (engine_ops))
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
while (info && info->protocol != proto)
|
||||
info = info->next;
|
||||
|
||||
if (!info)
|
||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
||||
|
||||
/* Prepare new members. */
|
||||
if (file_name)
|
||||
new_file_name = strdup (file_name);
|
||||
else
|
||||
{
|
||||
const char *ofile_name = engine_get_file_name (proto);
|
||||
assert (ofile_name);
|
||||
new_file_name = strdup (ofile_name);
|
||||
}
|
||||
if (!new_file_name)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
if (home_dir)
|
||||
{
|
||||
new_home_dir = strdup (home_dir);
|
||||
if (!new_home_dir)
|
||||
{
|
||||
free (new_file_name);
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
}
|
||||
else
|
||||
new_home_dir = NULL;
|
||||
|
||||
/* Remove the old members. */
|
||||
assert (info->file_name);
|
||||
free (info->file_name);
|
||||
if (info->home_dir)
|
||||
free (info->home_dir);
|
||||
if (info->version)
|
||||
free (info->version);
|
||||
|
||||
/* Install the new members. */
|
||||
info->file_name = new_file_name;
|
||||
info->home_dir = new_home_dir;
|
||||
info->version = engine_get_version (proto, new_file_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Set the default engine info for the protocol PROTO to the file name
|
||||
FILE_NAME and the home directory HOME_DIR. */
|
||||
gpgme_error_t
|
||||
gpgme_set_engine_info (gpgme_protocol_t proto,
|
||||
const char *file_name, const char *home_dir)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
gpgme_engine_info_t info;
|
||||
|
||||
LOCK (engine_info_lock);
|
||||
info = engine_info;
|
||||
if (!info)
|
||||
{
|
||||
/* Make sure it is initialized. */
|
||||
UNLOCK (engine_info_lock);
|
||||
err = gpgme_get_engine_info (&info);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
LOCK (engine_info_lock);
|
||||
}
|
||||
|
||||
err = _gpgme_set_engine_info (info, proto, file_name, home_dir);
|
||||
UNLOCK (engine_info_lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine)
|
||||
{
|
||||
engine_t engine;
|
||||
|
||||
if (!info->file_name || !info->version)
|
||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
||||
|
||||
engine = calloc (1, sizeof *engine);
|
||||
if (!engine)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
engine->ops = engine_ops[info->protocol];
|
||||
if (engine->ops->new)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
err = (*engine->ops->new) (&engine->engine,
|
||||
info->file_name, info->home_dir);
|
||||
if (err)
|
||||
{
|
||||
free (engine);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
else
|
||||
engine->engine = NULL;
|
||||
|
||||
*r_engine = engine;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_reset (engine_t engine)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->reset)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->reset) (engine->engine);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gpgme_engine_release (engine_t engine)
|
||||
{
|
||||
if (!engine)
|
||||
return;
|
||||
|
||||
if (engine->ops->release)
|
||||
(*engine->ops->release) (engine->engine);
|
||||
free (engine);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gpgme_engine_set_status_handler (engine_t engine,
|
||||
engine_status_handler_t fnc, void *fnc_value)
|
||||
{
|
||||
if (!engine)
|
||||
return;
|
||||
|
||||
if (engine->ops->set_status_handler)
|
||||
(*engine->ops->set_status_handler) (engine->engine, fnc, fnc_value);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_set_command_handler (engine_t engine,
|
||||
engine_command_handler_t fnc,
|
||||
void *fnc_value,
|
||||
gpgme_data_t linked_data)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->set_command_handler)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->set_command_handler) (engine->engine,
|
||||
fnc, fnc_value, linked_data);
|
||||
}
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_set_colon_line_handler (engine_t engine,
|
||||
engine_colon_line_handler_t fnc,
|
||||
void *fnc_value)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->set_colon_line_handler)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->set_colon_line_handler) (engine->engine,
|
||||
fnc, fnc_value);
|
||||
}
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_set_locale (engine_t engine, int category,
|
||||
const char *value)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->set_locale)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->set_locale) (engine->engine, category, value);
|
||||
}
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph,
|
||||
gpgme_data_t plain)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->decrypt)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->decrypt) (engine->engine, ciph, plain);
|
||||
}
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
|
||||
int allow_secret)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->delete)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->delete) (engine->engine, key, allow_secret);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_edit (engine_t engine, int type, gpgme_key_t key,
|
||||
gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->edit)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->edit) (engine->engine, type, key, out, ctx);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_encrypt (engine_t engine, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t ciph, int use_armor)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->encrypt)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->encrypt) (engine->engine, recp, flags, plain, ciph,
|
||||
use_armor);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_encrypt_sign (engine_t engine, gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor, gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->encrypt_sign)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->encrypt_sign) (engine->engine, recp, flags,
|
||||
plain, ciph, use_armor, ctx);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_export (engine_t engine, const char *pattern,
|
||||
unsigned int reserved, gpgme_data_t keydata,
|
||||
int use_armor)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->export)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->export) (engine->engine, pattern, reserved,
|
||||
keydata, use_armor);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_export_ext (engine_t engine, const char *pattern[],
|
||||
unsigned int reserved, gpgme_data_t keydata,
|
||||
int use_armor)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->export_ext)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->export_ext) (engine->engine, pattern, reserved,
|
||||
keydata, use_armor);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_genkey (engine_t engine, gpgme_data_t help_data,
|
||||
int use_armor, gpgme_data_t pubkey,
|
||||
gpgme_data_t seckey)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->genkey)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->genkey) (engine->engine, help_data, use_armor,
|
||||
pubkey, seckey);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_import (engine_t engine, gpgme_data_t keydata)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->import)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->import) (engine->engine, keydata);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_keylist (engine_t engine, const char *pattern,
|
||||
int secret_only, gpgme_keylist_mode_t mode)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->keylist)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->keylist) (engine->engine, pattern, secret_only, mode);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_keylist_ext (engine_t engine, const char *pattern[],
|
||||
int secret_only, int reserved,
|
||||
gpgme_keylist_mode_t mode)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->keylist_ext)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->keylist_ext) (engine->engine, pattern, secret_only,
|
||||
reserved, mode);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_sign (engine_t engine, gpgme_data_t in, gpgme_data_t out,
|
||||
gpgme_sig_mode_t mode, int use_armor,
|
||||
int use_textmode, int include_certs,
|
||||
gpgme_ctx_t ctx /* FIXME */)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->sign)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->sign) (engine->engine, in, out, mode, use_armor,
|
||||
use_textmode, include_certs, ctx);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_trustlist (engine_t engine, const char *pattern)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->trustlist)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->trustlist) (engine->engine, pattern);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
|
||||
gpgme_data_t signed_text, gpgme_data_t plaintext)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->verify)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->verify) (engine->engine, sig, signed_text, plaintext);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs)
|
||||
{
|
||||
if (!engine)
|
||||
return;
|
||||
|
||||
(*engine->ops->set_io_cbs) (engine->engine, io_cbs);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gpgme_engine_io_event (engine_t engine,
|
||||
gpgme_event_io_t type, void *type_data)
|
||||
{
|
||||
if (!engine)
|
||||
return;
|
||||
|
||||
(*engine->ops->io_event) (engine->engine, type, type_data);
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
_gpgme_engine_cancel (engine_t engine)
|
||||
{
|
||||
if (!engine)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (!engine->ops->cancel)
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
return (*engine->ops->cancel) (engine->engine);
|
||||
}
|
133
tags/gpgme-1.1.5/gpgme/engine.h
Normal file
133
tags/gpgme-1.1.5/gpgme/engine.h
Normal file
@ -0,0 +1,133 @@
|
||||
/* engine.h - GPGME engine interface.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
#include "gpgme.h"
|
||||
|
||||
struct engine;
|
||||
typedef struct engine *engine_t;
|
||||
|
||||
typedef gpgme_error_t (*engine_status_handler_t) (void *priv,
|
||||
gpgme_status_code_t code,
|
||||
char *args);
|
||||
typedef gpgme_error_t (*engine_colon_line_handler_t) (void *priv, char *line);
|
||||
typedef gpgme_error_t (*engine_command_handler_t) (void *priv,
|
||||
gpgme_status_code_t code,
|
||||
const char *keyword,
|
||||
int fd, int *processed);
|
||||
|
||||
/* Get a deep copy of the engine info and return it in INFO. */
|
||||
gpgme_error_t _gpgme_engine_info_copy (gpgme_engine_info_t *r_info);
|
||||
|
||||
/* Release the engine info INFO. */
|
||||
void _gpgme_engine_info_release (gpgme_engine_info_t info);
|
||||
|
||||
/* Set the engine info for the info list INFO, protocol PROTO, to the
|
||||
file name FILE_NAME and the home directory HOME_DIR. */
|
||||
gpgme_error_t _gpgme_set_engine_info (gpgme_engine_info_t info,
|
||||
gpgme_protocol_t praoto,
|
||||
const char *file_name,
|
||||
const char *home_dir);
|
||||
|
||||
|
||||
gpgme_error_t _gpgme_engine_new (gpgme_engine_info_t info,
|
||||
engine_t *r_engine);
|
||||
gpgme_error_t _gpgme_engine_reset (engine_t engine);
|
||||
|
||||
gpgme_error_t _gpgme_engine_set_locale (engine_t engine, int category,
|
||||
const char *value);
|
||||
|
||||
void _gpgme_engine_release (engine_t engine);
|
||||
void _gpgme_engine_set_status_handler (engine_t engine,
|
||||
engine_status_handler_t fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t _gpgme_engine_set_command_handler (engine_t engine,
|
||||
engine_command_handler_t fnc,
|
||||
void *fnc_value,
|
||||
gpgme_data_t data);
|
||||
gpgme_error_t
|
||||
_gpgme_engine_set_colon_line_handler (engine_t engine,
|
||||
engine_colon_line_handler_t fnc,
|
||||
void *fnc_value);
|
||||
gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine,
|
||||
gpgme_data_t ciph,
|
||||
gpgme_data_t plain);
|
||||
gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
|
||||
int allow_secret);
|
||||
gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type,
|
||||
gpgme_key_t key, gpgme_data_t out,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_encrypt (engine_t engine,
|
||||
gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain, gpgme_data_t ciph,
|
||||
int use_armor);
|
||||
gpgme_error_t _gpgme_engine_op_encrypt_sign (engine_t engine,
|
||||
gpgme_key_t recp[],
|
||||
gpgme_encrypt_flags_t flags,
|
||||
gpgme_data_t plain,
|
||||
gpgme_data_t ciph,
|
||||
int use_armor,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_export (engine_t engine, const char *pattern,
|
||||
unsigned int reserved,
|
||||
gpgme_data_t keydata, int use_armor);
|
||||
gpgme_error_t _gpgme_engine_op_export_ext (engine_t engine,
|
||||
const char *pattern[],
|
||||
unsigned int reserved,
|
||||
gpgme_data_t keydata,
|
||||
int use_armor);
|
||||
gpgme_error_t _gpgme_engine_op_genkey (engine_t engine,
|
||||
gpgme_data_t help_data,
|
||||
int use_armor, gpgme_data_t pubkey,
|
||||
gpgme_data_t seckey);
|
||||
gpgme_error_t _gpgme_engine_op_import (engine_t engine,
|
||||
gpgme_data_t keydata);
|
||||
gpgme_error_t _gpgme_engine_op_keylist (engine_t engine,
|
||||
const char *pattern,
|
||||
int secret_only,
|
||||
gpgme_keylist_mode_t mode);
|
||||
gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
|
||||
const char *pattern[],
|
||||
int secret_only,
|
||||
int reserved,
|
||||
gpgme_keylist_mode_t mode);
|
||||
gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
|
||||
gpgme_data_t out, gpgme_sig_mode_t mode,
|
||||
int use_armor, int use_textmode,
|
||||
int include_certs,
|
||||
gpgme_ctx_t ctx /* FIXME */);
|
||||
gpgme_error_t _gpgme_engine_op_trustlist (engine_t engine,
|
||||
const char *pattern);
|
||||
gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
|
||||
gpgme_data_t signed_text,
|
||||
gpgme_data_t plaintext);
|
||||
|
||||
void _gpgme_engine_set_io_cbs (engine_t engine,
|
||||
gpgme_io_cbs_t io_cbs);
|
||||
void _gpgme_engine_io_event (engine_t engine,
|
||||
gpgme_event_io_t type, void *type_data);
|
||||
|
||||
gpgme_error_t _gpgme_engine_cancel (engine_t engine);
|
||||
|
||||
#endif /* ENGINE_H */
|
92
tags/gpgme-1.1.5/gpgme/error.c
Normal file
92
tags/gpgme-1.1.5/gpgme/error.c
Normal file
@ -0,0 +1,92 @@
|
||||
/* error.c - Error handling for GPGME.
|
||||
Copyright (C) 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gpgme.h>
|
||||
|
||||
/* Return a pointer to a string containing a description of the error
|
||||
code in the error value ERR. */
|
||||
const char *
|
||||
gpgme_strerror (gpgme_error_t err)
|
||||
{
|
||||
return gpg_strerror (err);
|
||||
}
|
||||
|
||||
|
||||
/* Return the error string for ERR in the user-supplied buffer BUF of
|
||||
size BUFLEN. This function is, in contrast to gpg_strerror,
|
||||
thread-safe if a thread-safe strerror_r() function is provided by
|
||||
the system. If the function succeeds, 0 is returned and BUF
|
||||
contains the string describing the error. If the buffer was not
|
||||
large enough, ERANGE is returned and BUF contains as much of the
|
||||
beginning of the error string as fits into the buffer. */
|
||||
int
|
||||
gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen)
|
||||
{
|
||||
return gpg_strerror_r (err, buf, buflen);
|
||||
}
|
||||
|
||||
|
||||
/* Return a pointer to a string containing a description of the error
|
||||
source in the error value ERR. */
|
||||
const char *
|
||||
gpgme_strsource (gpgme_error_t err)
|
||||
{
|
||||
return gpg_strsource (err);
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the error code for the system error ERR. This returns
|
||||
GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
|
||||
this). */
|
||||
gpgme_err_code_t
|
||||
gpgme_err_code_from_errno (int err)
|
||||
{
|
||||
return gpg_err_code_from_errno (err);
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the system error for the error code CODE. This returns 0
|
||||
if CODE is not a system error code. */
|
||||
int
|
||||
gpgme_err_code_to_errno (gpgme_err_code_t code)
|
||||
{
|
||||
return gpg_err_code_from_errno (code);
|
||||
}
|
||||
|
||||
|
||||
/* Return an error value with the error source SOURCE and the system
|
||||
error ERR. */
|
||||
gpgme_error_t
|
||||
gpgme_err_make_from_errno (gpg_err_source_t source, int err)
|
||||
{
|
||||
return gpg_err_make_from_errno (source, err);
|
||||
}
|
||||
|
||||
|
||||
/* Return an error value with the system error ERR. */
|
||||
gpgme_err_code_t
|
||||
gpgme_error_from_errno (int err)
|
||||
{
|
||||
return gpgme_error (gpg_err_code_from_errno (err));
|
||||
}
|
117
tags/gpgme-1.1.5/gpgme/export.c
Normal file
117
tags/gpgme-1.1.5/gpgme/export.c
Normal file
@ -0,0 +1,117 @@
|
||||
/* export.c - Export a key.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
export_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
export_start (gpgme_ctx_t ctx, int synchronous, const char *pattern,
|
||||
unsigned int reserved, gpgme_data_t keydata)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
if (!keydata)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine, export_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_export (ctx->engine, pattern, reserved, keydata,
|
||||
ctx->use_armor);
|
||||
}
|
||||
|
||||
|
||||
/* Export the keys listed in RECP into KEYDATA. */
|
||||
gpgme_error_t
|
||||
gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern,
|
||||
unsigned int reserved, gpgme_data_t keydata)
|
||||
{
|
||||
return export_start (ctx, 0, pattern, reserved, keydata);
|
||||
}
|
||||
|
||||
|
||||
/* Export the keys listed in RECP into KEYDATA. */
|
||||
gpgme_error_t
|
||||
gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, unsigned int reserved,
|
||||
gpgme_data_t keydata)
|
||||
{
|
||||
gpgme_error_t err = export_start (ctx, 1, pattern, reserved, keydata);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
export_ext_start (gpgme_ctx_t ctx, int synchronous, const char *pattern[],
|
||||
unsigned int reserved, gpgme_data_t keydata)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
if (!keydata)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine, export_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_export_ext (ctx->engine, pattern, reserved, keydata,
|
||||
ctx->use_armor);
|
||||
}
|
||||
|
||||
|
||||
/* Export the keys listed in RECP into KEYDATA. */
|
||||
gpgme_error_t
|
||||
gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[],
|
||||
unsigned int reserved, gpgme_data_t keydata)
|
||||
{
|
||||
return export_ext_start (ctx, 0, pattern, reserved, keydata);
|
||||
}
|
||||
|
||||
|
||||
/* Export the keys listed in RECP into KEYDATA. */
|
||||
gpgme_error_t
|
||||
gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
|
||||
unsigned int reserved, gpgme_data_t keydata)
|
||||
{
|
||||
gpgme_error_t err = export_ext_start (ctx, 1, pattern, reserved, keydata);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
63
tags/gpgme-1.1.5/gpgme/funopen.c
Normal file
63
tags/gpgme-1.1.5/gpgme/funopen.c
Normal file
@ -0,0 +1,63 @@
|
||||
/* funopen.c - Replacement for funopen.
|
||||
Copyright (C) 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/* Replacement for the *BSD function:
|
||||
|
||||
FILE *funopen (void *cookie,
|
||||
int (*readfn)(void *, char *, int),
|
||||
int (*writefn)(void *, const char *, int),
|
||||
fpos_t (*seekfn)(void *, fpos_t, int),
|
||||
int (*closefn)(void *));
|
||||
|
||||
The functions to provide my either be NULL if not required or
|
||||
similar to the unistd function with the exception of using the
|
||||
cookie instead of the fiel descripor.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_FOPENCOOKIE
|
||||
FILE *
|
||||
_gpgme_funopen(void *cookie,
|
||||
cookie_read_function_t *readfn,
|
||||
cookie_write_function_t *writefn,
|
||||
cookie_seek_function_t *seekfn,
|
||||
cookie_close_function_t *closefn)
|
||||
{
|
||||
cookie_io_functions_t io = { NULL };
|
||||
|
||||
io.read = readfn;
|
||||
io.write = writefn;
|
||||
io.seek = seekfn;
|
||||
io.close = closefn;
|
||||
|
||||
return fopencookie (cookie,
|
||||
readfn ? ( writefn ? "rw" : "r" )
|
||||
: ( writefn ? "w" : ""), io);
|
||||
}
|
||||
#else
|
||||
#error No known way to implement funopen.
|
||||
#endif
|
206
tags/gpgme-1.1.5/gpgme/genkey.c
Normal file
206
tags/gpgme-1.1.5/gpgme/genkey.c
Normal file
@ -0,0 +1,206 @@
|
||||
/* genkey.c - Key generation.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gpgme.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct _gpgme_op_genkey_result result;
|
||||
|
||||
/* The key parameters passed to the crypto engine. */
|
||||
gpgme_data_t key_parameter;
|
||||
} *op_data_t;
|
||||
|
||||
|
||||
static void
|
||||
release_op_data (void *hook)
|
||||
{
|
||||
op_data_t opd = (op_data_t) hook;
|
||||
|
||||
if (opd->result.fpr)
|
||||
free (opd->result.fpr);
|
||||
if (opd->key_parameter)
|
||||
gpgme_data_release (opd->key_parameter);
|
||||
}
|
||||
|
||||
|
||||
gpgme_genkey_result_t
|
||||
gpgme_op_genkey_result (gpgme_ctx_t ctx)
|
||||
{
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err || !opd)
|
||||
return NULL;
|
||||
|
||||
return &opd->result;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
genkey_status_handler (void *priv, gpgme_status_code_t code, char *args)
|
||||
{
|
||||
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
|
||||
/* Pipe the status code through the progress status handler. */
|
||||
err = _gpgme_progress_status_handler (ctx, code, args);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case GPGME_STATUS_KEY_CREATED:
|
||||
if (args && *args)
|
||||
{
|
||||
if (*args == 'B' || *args == 'P')
|
||||
opd->result.primary = 1;
|
||||
if (*args == 'B' || *args == 'S')
|
||||
opd->result.sub = 1;
|
||||
if (args[1] == ' ')
|
||||
{
|
||||
if (opd->result.fpr)
|
||||
free (opd->result.fpr);
|
||||
opd->result.fpr = strdup (&args[2]);
|
||||
if (!opd->result.fpr)
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GPGME_STATUS_EOF:
|
||||
/* FIXME: Should return some more useful error value. */
|
||||
if (!opd->result.primary && !opd->result.sub)
|
||||
return gpg_error (GPG_ERR_GENERAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
get_key_parameter (const char *parms, gpgme_data_t *key_parameter)
|
||||
{
|
||||
const char *content;
|
||||
const char *attrib;
|
||||
const char *endtag;
|
||||
|
||||
/* Extract the key parameter from the XML structure. */
|
||||
parms = strstr (parms, "<GnupgKeyParms ");
|
||||
if (!parms)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
content = strchr (parms, '>');
|
||||
if (!content)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
content++;
|
||||
|
||||
attrib = strstr (parms, "format=\"internal\"");
|
||||
if (!attrib || attrib >= content)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
endtag = strstr (content, "</GnupgKeyParms>");
|
||||
/* FIXME: Check that there are no control statements inside. */
|
||||
while (content[0] == '\n'
|
||||
|| (content[0] == '\r' && content[1] == '\n'))
|
||||
content++;
|
||||
|
||||
return gpgme_data_new_from_mem (key_parameter, content,
|
||||
endtag - content, 1);
|
||||
}
|
||||
|
||||
|
||||
static gpgme_error_t
|
||||
genkey_start (gpgme_ctx_t ctx, int synchronous, const char *parms,
|
||||
gpgme_data_t pubkey, gpgme_data_t seckey)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
void *hook;
|
||||
op_data_t opd;
|
||||
err = _gpgme_op_reset (ctx, synchronous);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook,
|
||||
sizeof (*opd), release_op_data);
|
||||
opd = hook;
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = get_key_parameter (parms, &opd->key_parameter);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
_gpgme_engine_set_status_handler (ctx->engine, genkey_status_handler, ctx);
|
||||
|
||||
return _gpgme_engine_op_genkey (ctx->engine, opd->key_parameter,
|
||||
ctx->use_armor, pubkey, seckey);
|
||||
}
|
||||
|
||||
|
||||
/* Generate a new keypair and add it to the keyring. PUBKEY and
|
||||
SECKEY should be null for now. PARMS specifies what keys should be
|
||||
generated. */
|
||||
gpgme_error_t
|
||||
gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms,
|
||||
gpgme_data_t pubkey, gpgme_data_t seckey)
|
||||
{
|
||||
return genkey_start (ctx, 0, parms, pubkey, seckey);
|
||||
}
|
||||
|
||||
|
||||
/* Generate a new keypair and add it to the keyring. PUBKEY and
|
||||
SECKEY should be null for now. PARMS specifies what keys should be
|
||||
generated. */
|
||||
gpgme_error_t
|
||||
gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, gpgme_data_t pubkey,
|
||||
gpgme_data_t seckey)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = genkey_start (ctx, 1, parms, pubkey, seckey);
|
||||
if (!err)
|
||||
err = _gpgme_wait_one (ctx);
|
||||
return err;
|
||||
}
|
59
tags/gpgme-1.1.5/gpgme/get-env.c
Normal file
59
tags/gpgme-1.1.5/gpgme/get-env.c
Normal file
@ -0,0 +1,59 @@
|
||||
/* get_env.c - A getenv() replacement.
|
||||
Copyright (C) 2003, 2004 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#if defined(HAVE_THREAD_SAFE_GETENV) || !defined (HAVE_GETENV_R)
|
||||
/* We prefer using getenv() if it is thread-safe. */
|
||||
|
||||
/* Retrieve the environment variable NAME and return a copy of it in a
|
||||
malloc()'ed buffer in *VALUE. If the environment variable is not
|
||||
set, return NULL in *VALUE. */
|
||||
gpgme_error_t
|
||||
_gpgme_getenv (const char *name, char **value)
|
||||
{
|
||||
char *env_value;
|
||||
|
||||
env_value = getenv (name);
|
||||
if (!env_value)
|
||||
*value = NULL;
|
||||
else
|
||||
{
|
||||
*value = strdup (env_value);
|
||||
if (!*value)
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* FIXME: Implement this when we have the specification for it. */
|
||||
#error Use of getenv_r not implemented.
|
||||
|
||||
#endif
|
162
tags/gpgme-1.1.5/gpgme/gpgme-config.in
Normal file
162
tags/gpgme-1.1.5/gpgme/gpgme-config.in
Normal file
@ -0,0 +1,162 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
includedir=@includedir@
|
||||
libdir=@libdir@
|
||||
|
||||
# Network libraries.
|
||||
netlibs="@NETLIBS@"
|
||||
|
||||
# Configure libgpg-error.
|
||||
gpg_error_cflags="@GPG_ERROR_CFLAGS@"
|
||||
gpg_error_libs="@GPG_ERROR_LIBS@"
|
||||
|
||||
# Configure thread packages.
|
||||
thread_modules=""
|
||||
|
||||
@HAVE_PTH_TRUE@thread_modules="$thread_modules pth"
|
||||
libs_pth="@PTH_LDFLAGS@ @PTH_LIBS@"
|
||||
cflags_pth="@PTH_CFLAGS@"
|
||||
|
||||
@HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread"
|
||||
libs_pthread="-lpthread"
|
||||
cflags_pthread=""
|
||||
|
||||
# Configure glib.
|
||||
libs_glib="@GLIB_LIBS@"
|
||||
cflags_glib="@GLIB_CFLAGS@"
|
||||
with_glib=
|
||||
|
||||
output=""
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: gpgme-config [OPTIONS]
|
||||
Options:
|
||||
[--thread={${thread_modules}}]
|
||||
[--prefix]
|
||||
[--exec-prefix]
|
||||
[--version]
|
||||
[--api-version]
|
||||
[--libs]
|
||||
[--cflags]
|
||||
[--get-gpg]
|
||||
[--get-gpgsm]
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1 1>&2
|
||||
fi
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*)
|
||||
optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
|
||||
;;
|
||||
*)
|
||||
optarg=
|
||||
;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
# For compatibility reasons with old M4 macros, we ignore
|
||||
# setting of prefix.
|
||||
;;
|
||||
--prefix)
|
||||
output="$output $prefix"
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
;;
|
||||
--exec-prefix)
|
||||
output="$output $exec_prefix"
|
||||
;;
|
||||
--glib)
|
||||
with_glib=yes
|
||||
;;
|
||||
--version)
|
||||
echo "@VERSION@"
|
||||
exit 0
|
||||
;;
|
||||
--api-version)
|
||||
echo "@GPGME_CONFIG_API_VERSION@"
|
||||
exit 0
|
||||
;;
|
||||
--cflags)
|
||||
if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then
|
||||
output="$output -I$includedir"
|
||||
fi
|
||||
case "$thread_module" in
|
||||
pthread)
|
||||
output="$output $cflags_pthread"
|
||||
;;
|
||||
pth)
|
||||
output="$output $cflags_pth"
|
||||
;;
|
||||
esac
|
||||
output="$output $gpg_error_cflags"
|
||||
if test "x$with_glib" = "xyes"; then
|
||||
output="$output $glib_cflags"
|
||||
fi
|
||||
;;
|
||||
--libs)
|
||||
if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
|
||||
output="$output -L$libdir"
|
||||
fi
|
||||
case "$thread_module" in
|
||||
pthread)
|
||||
output="$output -lgpgme-pthread $libs_pthread"
|
||||
;;
|
||||
pth)
|
||||
output="$output -lgpgme-pth $libs_pth"
|
||||
;;
|
||||
*)
|
||||
if test "x$with_glib" = "xyes"; then
|
||||
output="$output -lgpgme-glib"
|
||||
else
|
||||
output="$output -lgpgme"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
output="$output $gpg_error_libs $netlibs"
|
||||
if test "x$with_glib" = "xyes"; then
|
||||
output="$output $glib_cflags"
|
||||
fi
|
||||
;;
|
||||
--thread=*)
|
||||
for thread_mod in $thread_modules; do
|
||||
if test "$thread_mod" = "$optarg"; then
|
||||
thread_module="$optarg";
|
||||
fi
|
||||
done
|
||||
if test "x$thread_module" = "x"; then
|
||||
usage 1 1>&2
|
||||
fi
|
||||
;;
|
||||
--get-gpg)
|
||||
output="$output @GPG@"
|
||||
;;
|
||||
--get-gpgsm)
|
||||
output="$output @GPGSM@"
|
||||
;;
|
||||
*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
echo $output
|
582
tags/gpgme-1.1.5/gpgme/gpgme.c
Normal file
582
tags/gpgme-1.1.5/gpgme/gpgme.c
Normal file
@ -0,0 +1,582 @@
|
||||
/* gpgme.c - GnuPG Made Easy.
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
GPGME is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GPGME is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "context.h"
|
||||
#include "ops.h"
|
||||
#include "wait.h"
|
||||
|
||||
|
||||
/* The default locale. */
|
||||
DEFINE_STATIC_LOCK (def_lc_lock);
|
||||
static char *def_lc_ctype;
|
||||
static char *def_lc_messages;
|
||||
|
||||
|
||||
/* Create a new context as an environment for GPGME crypto
|
||||
operations. */
|
||||
gpgme_error_t
|
||||
gpgme_new (gpgme_ctx_t *r_ctx)
|
||||
{
|
||||
gpgme_ctx_t ctx;
|
||||
|
||||
ctx = calloc (1, sizeof *ctx);
|
||||
if (!ctx)
|
||||
return gpg_error_from_errno (errno);
|
||||
|
||||
_gpgme_engine_info_copy (&ctx->engine_info);
|
||||
if (!ctx->engine_info)
|
||||
{
|
||||
free (ctx);
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
|
||||
ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL;
|
||||
ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT;
|
||||
ctx->protocol = GPGME_PROTOCOL_OpenPGP;
|
||||
_gpgme_fd_table_init (&ctx->fdt);
|
||||
|
||||
LOCK (def_lc_lock);
|
||||
if (def_lc_ctype)
|
||||
{
|
||||
ctx->lc_ctype = strdup (def_lc_ctype);
|
||||
if (!ctx->lc_ctype)
|
||||
{
|
||||
UNLOCK (def_lc_lock);
|
||||
_gpgme_engine_info_release (ctx->engine_info);
|
||||
free (ctx);
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
}
|
||||
else
|
||||
def_lc_ctype = NULL;
|
||||
|
||||
if (def_lc_messages)
|
||||
{
|
||||
ctx->lc_messages = strdup (def_lc_messages);
|
||||
if (!ctx->lc_messages)
|
||||
{
|
||||
UNLOCK (def_lc_lock);
|
||||
if (ctx->lc_ctype)
|
||||
free (ctx->lc_ctype);
|
||||
_gpgme_engine_info_release (ctx->engine_info);
|
||||
free (ctx);
|
||||
return gpg_error_from_errno (errno);
|
||||
}
|
||||
}
|
||||
else
|
||||
def_lc_messages = NULL;
|
||||
UNLOCK (def_lc_lock);
|
||||
|
||||
*r_ctx = ctx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Cancel a pending asynchronous operation. */
|
||||
gpgme_error_t
|
||||
gpgme_cancel (gpgme_ctx_t ctx)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
|
||||
err = _gpgme_engine_cancel (ctx->engine);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = gpg_error (GPG_ERR_CANCELED);
|
||||
_gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Release all resources associated with the given context. */
|
||||
void
|
||||
gpgme_release (gpgme_ctx_t ctx)
|
||||
{
|
||||
_gpgme_engine_release (ctx->engine);
|
||||
_gpgme_fd_table_deinit (&ctx->fdt);
|
||||
_gpgme_release_result (ctx);
|
||||
gpgme_signers_clear (ctx);
|
||||
if (ctx->signers)
|
||||
free (ctx->signers);
|
||||
if (ctx->lc_ctype)
|
||||
free (ctx->lc_ctype);
|
||||
if (ctx->lc_messages)
|
||||
free (ctx->lc_messages);
|
||||
_gpgme_engine_info_release (ctx->engine_info);
|
||||
free (ctx);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gpgme_release_result (gpgme_ctx_t ctx)
|
||||
{
|
||||
struct ctx_op_data *data = ctx->op_data;
|
||||
|
||||
while (data)
|
||||
{
|
||||
struct ctx_op_data *next_data = data->next;
|
||||
if (data->cleanup)
|
||||
(*data->cleanup) (data->hook);
|
||||
free (data);
|
||||
data = next_data;
|
||||
}
|
||||
ctx->op_data = NULL;
|
||||
}
|
||||
|
||||
|
||||
gpgme_error_t
|
||||
gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
|
||||
{
|
||||
if (protocol != GPGME_PROTOCOL_OpenPGP && protocol != GPGME_PROTOCOL_CMS)
|
||||
return gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (ctx->protocol != protocol)
|
||||
{
|
||||
/* Shut down the engine when switching protocols. */
|
||||
if (ctx->engine)
|
||||
{
|
||||
_gpgme_engine_release (ctx->engine);
|
||||
ctx->engine = NULL;
|
||||
}
|
||||
|
||||
ctx->protocol = protocol;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
gpgme_protocol_t
|
||||
gpgme_get_protocol (gpgme_ctx_t ctx)
|
||||
{
|
||||
return ctx->protocol;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gpgme_get_protocol_name (gpgme_protocol_t protocol)
|
||||
{
|
||||
switch (protocol)
|
||||
{
|
||||
case GPGME_PROTOCOL_OpenPGP:
|
||||
return "OpenPGP";
|
||||
|
||||
case GPGME_PROTOCOL_CMS:
|
||||
return "CMS";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable or disable the use of an ascii armor for all output. */
|
||||
void
|
||||
gpgme_set_armor (gpgme_ctx_t ctx, int yes)
|
||||
{
|
||||
ctx->use_armor = yes;
|
||||
}
|
||||
|
||||
|
||||
/* Return the state of the armor flag. */
|
||||
int
|
||||
gpgme_get_armor (gpgme_ctx_t ctx)
|
||||
{
|
||||
return ctx->use_armor;
|
||||
}
|
||||
|
||||
|
||||
/* Enable or disable the use of the special textmode. Textmode is for
|
||||
example used for the RFC2015 signatures; note that the updated RFC
|
||||
3156 mandates that the MUA does some preparations so that textmode
|
||||
is not needed anymore. */
|
||||
void
|
||||
gpgme_set_textmode (gpgme_ctx_t ctx, int yes)
|
||||
{
|
||||
ctx->use_textmode = yes;
|
||||
}
|
||||
|
||||
/* Return the state of the textmode flag. */
|
||||
int
|
||||
gpgme_get_textmode (gpgme_ctx_t ctx)
|
||||
{
|
||||
return ctx->use_textmode;
|
||||
}
|
||||
|
||||
|
||||
/* Set the number of certifications to include in an S/MIME message.
|
||||
The default is GPGME_INCLUDE_CERTS_DEFAULT. -1 means all certs,
|
||||
and -2 means all certs except the root cert. */
|
||||
void
|
||||
gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
|
||||
{
|
||||
if (nr_of_certs == GPGME_INCLUDE_CERTS_DEFAULT)
|
||||
ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT;
|
||||
else if (nr_of_certs < -2)
|
||||
ctx->include_certs = -2;
|
||||
else
|
||||
ctx->include_certs = nr_of_certs;
|
||||
}
|
||||
|
||||
|
||||
/* Get the number of certifications to include in an S/MIME
|
||||
message. */
|
||||
int
|
||||
gpgme_get_include_certs (gpgme_ctx_t ctx)
|
||||
{
|
||||
return ctx->include_certs;
|
||||
}
|
||||
|
||||
|
||||
/* This function changes the default behaviour of the keylisting
|
||||
functions. MODE is a bitwise-OR of the GPGME_KEYLIST_* flags. The
|
||||
default mode is GPGME_KEYLIST_MODE_LOCAL. */
|
||||
gpgme_error_t
|
||||
gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode)
|
||||
{
|
||||
ctx->keylist_mode = mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function returns the default behaviour of the keylisting
|
||||
functions. */
|
||||
gpgme_keylist_mode_t
|
||||
gpgme_get_keylist_mode (gpgme_ctx_t ctx)
|
||||
{
|
||||
return ctx->keylist_mode;
|
||||
}
|
||||
|
||||
|
||||
/* This function sets a callback function to be used to pass a
|
||||
passphrase to gpg. */
|
||||
void
|
||||
gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb,
|
||||
void *cb_value)
|
||||
{
|
||||
ctx->passphrase_cb = cb;
|
||||
ctx->passphrase_cb_value = cb_value;
|
||||
}
|
||||
|
||||
|
||||
/* This function returns the callback function to be used to pass a
|
||||
passphrase to the crypto engine. */
|
||||
void
|
||||
gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb,
|
||||
void **r_cb_value)
|
||||
{
|
||||
if (r_cb)
|
||||
*r_cb = ctx->passphrase_cb;
|
||||
if (r_cb_value)
|
||||
*r_cb_value = ctx->passphrase_cb_value;
|
||||
}
|
||||
|
||||
|
||||
/* This function sets a callback function to be used as a progress
|
||||
indicator. */
|
||||
void
|
||||
gpgme_set_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t cb, void *cb_value)
|
||||
{
|
||||
ctx->progress_cb = cb;
|
||||
ctx->progress_cb_value = cb_value;
|
||||
}
|
||||
|
||||
|
||||
/* This function returns the callback function to be used as a
|
||||
progress indicator. */
|
||||
void
|
||||
gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
|
||||
void **r_cb_value)
|
||||
{
|
||||
if (r_cb)
|
||||
*r_cb = ctx->progress_cb;
|
||||
if (r_cb_value)
|
||||
*r_cb_value = ctx->progress_cb_value;
|
||||
}
|
||||
|
||||
|
||||
/* Set the I/O callback functions for CTX to IO_CBS. */
|
||||
void
|
||||
gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
|
||||
{
|
||||
if (io_cbs)
|
||||
ctx->io_cbs = *io_cbs;
|
||||
else
|
||||
{
|
||||
ctx->io_cbs.add = NULL;
|
||||
ctx->io_cbs.add_priv = NULL;
|
||||
ctx->io_cbs.remove = NULL;
|
||||
ctx->io_cbs.event = NULL;
|
||||
ctx->io_cbs.event_priv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function returns the callback function for I/O. */
|
||||
void
|
||||
gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
|
||||
{
|
||||
*io_cbs = ctx->io_cbs;
|
||||
}
|
||||
|
||||
|
||||
/* This function sets the locale for the context CTX, or the default
|
||||
locale if CTX is a null pointer. */
|
||||
gpgme_error_t
|
||||
gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
|
||||
{
|
||||
int failed = 0;
|
||||
char *new_lc_ctype = NULL;
|
||||
char *new_lc_messages = NULL;
|
||||
|
||||
#define PREPARE_ONE_LOCALE(lcat, ucat) \
|
||||
if (!failed && value \
|
||||
&& (category == LC_ALL || category == LC_ ## ucat)) \
|
||||
{ \
|
||||
new_lc_ ## lcat = strdup (value); \
|
||||
if (!new_lc_ ## lcat) \
|
||||
failed = 1; \
|
||||
}
|
||||
|
||||
PREPARE_ONE_LOCALE (ctype, CTYPE);
|
||||
#ifdef LC_MESSAGES
|
||||
PREPARE_ONE_LOCALE (messages, MESSAGES);
|
||||
#endif
|
||||
|
||||
if (failed)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
|
||||
if (new_lc_ctype)
|
||||
free (new_lc_ctype);
|
||||
if (new_lc_messages)
|
||||
free (new_lc_messages);
|
||||
|
||||
return gpg_error_from_errno (saved_errno);
|
||||
}
|
||||
|
||||
#define SET_ONE_LOCALE(lcat, ucat) \
|
||||
if (category == LC_ALL || category == LC_ ## ucat) \
|
||||
{ \
|
||||
if (ctx) \
|
||||
{ \
|
||||
if (ctx->lc_ ## lcat) \
|
||||
free (ctx->lc_ ## lcat); \
|
||||
ctx->lc_ ## lcat = new_lc_ ## lcat; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (def_lc_ ## lcat) \
|
||||
free (def_lc_ ## lcat); \
|
||||
def_lc_ ## lcat = new_lc_ ## lcat; \
|
||||
} \
|
||||
}
|
||||
|
||||
if (!ctx)
|
||||
LOCK (def_lc_lock);
|
||||
SET_ONE_LOCALE (ctype, CTYPE);
|
||||
#ifdef LC_MESSAGES
|
||||
SET_ONE_LOCALE (messages, MESSAGES);
|
||||
#endif
|
||||
if (!ctx)
|
||||
UNLOCK (def_lc_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get the information about the configured engines. A pointer to the
|
||||
first engine in the statically allocated linked list is returned.
|
||||
The returned data is valid until the next gpgme_ctx_set_engine_info. */
|
||||
gpgme_engine_info_t
|
||||
gpgme_ctx_get_engine_info (gpgme_ctx_t ctx)
|
||||
{
|
||||
return ctx->engine_info;
|
||||
}
|
||||
|
||||
|
||||
/* Set the engine info for the context CTX, protocol PROTO, to the
|
||||
file name FILE_NAME and the home directory HOME_DIR. */
|
||||
gpgme_error_t
|
||||
gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto,
|
||||
const char *file_name, const char *home_dir)
|
||||
{
|
||||
/* Shut down the engine when changing engine info. */
|
||||
if (ctx->engine)
|
||||
{
|
||||
_gpgme_engine_release (ctx->engine);
|
||||
ctx->engine = NULL;
|
||||
}
|
||||
return _gpgme_set_engine_info (ctx->engine_info, proto,
|
||||
file_name, home_dir);
|
||||
}
|
||||
|
||||
|
||||
/* Clear all notation data from the context. */
|
||||
void
|
||||
gpgme_sig_notation_clear (gpgme_ctx_t ctx)
|
||||
{
|
||||
gpgme_sig_notation_t notation;
|
||||
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
notation = ctx->sig_notations;
|
||||
while (notation)
|
||||
{
|
||||
gpgme_sig_notation_t next_notation = notation->next;
|
||||
_gpgme_sig_notation_free (notation);
|
||||
notation = next_notation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Add the human-readable notation data with name NAME and value VALUE
|
||||
to the context CTX, using the flags FLAGS. If NAME is NULL, then
|
||||
VALUE should be a policy URL. The flag
|
||||
GPGME_SIG_NOTATION_HUMAN_READABLE is forced to be true for notation
|
||||
data, and false for policy URLs. */
|
||||
gpgme_error_t
|
||||
gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
|
||||
const char *value, gpgme_sig_notation_flags_t flags)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
gpgme_sig_notation_t notation;
|
||||
gpgme_sig_notation_t *lastp;
|
||||
|
||||
if (!ctx)
|
||||
gpg_error (GPG_ERR_INV_VALUE);
|
||||
|
||||
if (name)
|
||||
flags |= GPGME_SIG_NOTATION_HUMAN_READABLE;
|
||||
else
|
||||
flags &= ~GPGME_SIG_NOTATION_HUMAN_READABLE;
|
||||
|
||||
err = _gpgme_sig_notation_create (¬ation, name, name ? strlen (name) : 0,
|
||||
value, value ? strlen (value) : 0, flags);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
lastp = &ctx->sig_notations;
|
||||
while (*lastp)
|
||||
lastp = &(*lastp)->next;
|
||||
|
||||
*lastp = notation;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get the sig notations for this context. */
|
||||
gpgme_sig_notation_t
|
||||
gpgme_sig_notation_get (gpgme_ctx_t ctx)
|
||||
{
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
|
||||
return ctx->sig_notations;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo)
|
||||
{
|
||||
switch (algo)
|
||||
{
|
||||
case GPGME_PK_RSA:
|
||||
return "RSA";
|
||||
|
||||
case GPGME_PK_RSA_E:
|
||||
return "RSA-E";
|
||||
|
||||
case GPGME_PK_RSA_S:
|
||||
return "RSA-S";
|
||||
|
||||
case GPGME_PK_ELG_E:
|
||||
return "ELG-E";
|
||||
|
||||
case GPGME_PK_DSA:
|
||||
return "DSA";
|
||||
|
||||
case GPGME_PK_ELG:
|
||||
return "ELG";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
gpgme_hash_algo_name (gpgme_hash_algo_t algo)
|
||||
{
|
||||
switch (algo)
|
||||
{
|
||||
case GPGME_MD_MD5:
|
||||
return "MD5";
|
||||
|
||||
case GPGME_MD_SHA1:
|
||||
return "SHA1";
|
||||
|
||||
case GPGME_MD_RMD160:
|
||||
return "RIPEMD160";
|
||||
|
||||
case GPGME_MD_MD2:
|
||||
return "MD2";
|
||||
|
||||
case GPGME_MD_TIGER:
|
||||
return "TIGER192";
|
||||
|
||||
case GPGME_MD_HAVAL:
|
||||
return "HAVAL";
|
||||
|
||||
case GPGME_MD_SHA256:
|
||||
return "SHA256";
|
||||
|
||||
case GPGME_MD_SHA384:
|
||||
return "SHA384";
|
||||
|
||||
case GPGME_MD_SHA512:
|
||||
return "SHA512";
|
||||
|
||||
case GPGME_MD_MD4:
|
||||
return "MD4";
|
||||
|
||||
case GPGME_MD_CRC32:
|
||||
return "CRC32";
|
||||
|
||||
case GPGME_MD_CRC32_RFC1510:
|
||||
return "CRC32RFC1510";
|
||||
|
||||
case GPGME_MD_CRC24_RFC2440:
|
||||
return "CRC24RFC2440";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
158
tags/gpgme-1.1.5/gpgme/gpgme.def
Normal file
158
tags/gpgme-1.1.5/gpgme/gpgme.def
Normal file
@ -0,0 +1,158 @@
|
||||
; gpgme.def - List of symbols to export.
|
||||
; Copyright (C) 2005 g10 Code GmbH
|
||||
;
|
||||
; This file is part of GPGME.
|
||||
;
|
||||
; GPGME is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU Lesser general Public License as
|
||||
; published by the Free Software Foundation; either version 2.1 of
|
||||
; the License, or (at your option) any later version.
|
||||
;
|
||||
; GPGME is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; GNU Lesser General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU Lesser General Public
|
||||
; License along with this program; if not, write to the Free Software
|
||||
; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
|
||||
EXPORTS
|
||||
gpgme_check_version @1
|
||||
gpgme_get_engine_info @2
|
||||
gpgme_engine_check_version @3
|
||||
|
||||
gpgme_err_code_from_errno @4
|
||||
gpgme_err_code_to_errno @5
|
||||
gpgme_err_make_from_errno @6
|
||||
gpgme_error_from_errno @7
|
||||
gpgme_strerror @8
|
||||
gpgme_strerror_r @9
|
||||
gpgme_strsource @10
|
||||
|
||||
gpgme_data_get_encoding @11
|
||||
gpgme_data_new @12
|
||||
gpgme_data_new_from_cbs @13
|
||||
gpgme_data_new_from_fd @14
|
||||
gpgme_data_new_from_file @15
|
||||
gpgme_data_new_from_filepart @16
|
||||
gpgme_data_new_from_mem @17
|
||||
gpgme_data_new_from_stream @18
|
||||
gpgme_data_read @19
|
||||
gpgme_data_release @20
|
||||
gpgme_data_release_and_get_mem @21
|
||||
gpgme_data_seek @22
|
||||
gpgme_data_set_encoding @23
|
||||
gpgme_data_write @24
|
||||
|
||||
gpgme_get_protocol_name @25
|
||||
gpgme_hash_algo_name @26
|
||||
gpgme_pubkey_algo_name @27
|
||||
|
||||
gpgme_new @28
|
||||
gpgme_get_armor @29
|
||||
gpgme_get_include_certs @30
|
||||
gpgme_get_io_cbs @31
|
||||
gpgme_get_keylist_mode @32
|
||||
gpgme_get_passphrase_cb @33
|
||||
gpgme_get_progress_cb @34
|
||||
gpgme_get_protocol @35
|
||||
gpgme_get_textmode @36
|
||||
gpgme_release @37
|
||||
gpgme_set_armor @38
|
||||
gpgme_set_include_certs @39
|
||||
gpgme_set_io_cbs @40
|
||||
gpgme_set_keylist_mode @41
|
||||
gpgme_set_locale @42
|
||||
gpgme_set_passphrase_cb @43
|
||||
gpgme_set_progress_cb @44
|
||||
gpgme_set_protocol @45
|
||||
gpgme_set_textmode @46
|
||||
gpgme_signers_add @47
|
||||
gpgme_signers_clear @48
|
||||
gpgme_signers_enum @49
|
||||
|
||||
gpgme_key_ref @50
|
||||
gpgme_key_unref @51
|
||||
gpgme_key_release @52
|
||||
|
||||
gpgme_trust_item_ref @53
|
||||
gpgme_trust_item_unref @54
|
||||
|
||||
gpgme_cancel @55
|
||||
gpgme_op_card_edit @56
|
||||
gpgme_op_card_edit_start @57
|
||||
gpgme_op_decrypt @58
|
||||
gpgme_op_decrypt_result @59
|
||||
gpgme_op_decrypt_start @60
|
||||
gpgme_op_decrypt_verify @61
|
||||
gpgme_op_decrypt_verify_start @62
|
||||
gpgme_op_delete @63
|
||||
gpgme_op_delete_start @64
|
||||
gpgme_op_edit @65
|
||||
gpgme_op_edit_start @66
|
||||
gpgme_op_encrypt @67
|
||||
gpgme_op_encrypt_result @68
|
||||
gpgme_op_encrypt_sign @69
|
||||
gpgme_op_encrypt_sign_start @70
|
||||
gpgme_op_encrypt_start @71
|
||||
gpgme_op_export @72
|
||||
gpgme_op_export_ext @73
|
||||
gpgme_op_export_ext_start @74
|
||||
gpgme_op_export_start @75
|
||||
gpgme_op_genkey @76
|
||||
gpgme_op_genkey_result @77
|
||||
gpgme_op_genkey_start @78
|
||||
gpgme_get_key @79
|
||||
gpgme_op_import @80
|
||||
gpgme_op_import_result @81
|
||||
gpgme_op_import_start @82
|
||||
gpgme_op_keylist_end @83
|
||||
gpgme_op_keylist_ext_start @84
|
||||
gpgme_op_keylist_next @85
|
||||
gpgme_op_keylist_result @86
|
||||
gpgme_op_keylist_start @87
|
||||
gpgme_op_sign @88
|
||||
gpgme_op_sign_result @89
|
||||
gpgme_op_sign_start @90
|
||||
gpgme_op_trustlist_end @91
|
||||
gpgme_op_trustlist_next @92
|
||||
gpgme_op_trustlist_start @93
|
||||
gpgme_op_verify @94
|
||||
gpgme_op_verify_result @95
|
||||
gpgme_op_verify_start @96
|
||||
gpgme_wait @97
|
||||
|
||||
gpgme_data_new_with_read_cb @98
|
||||
gpgme_data_rewind @99
|
||||
gpgme_get_sig_status @100
|
||||
gpgme_get_sig_string_attr @101
|
||||
gpgme_get_sig_ulong_attr @102
|
||||
gpgme_get_sig_key @103
|
||||
gpgme_key_get_string_attr @104
|
||||
gpgme_key_get_ulong_attr @105
|
||||
gpgme_key_sig_get_string_attr @106
|
||||
gpgme_key_sig_get_ulong_attr @107
|
||||
gpgme_op_import_ext @108
|
||||
gpgme_trust_item_get_int_attr @109
|
||||
gpgme_trust_item_get_string_attr @110
|
||||
gpgme_trust_item_release @111
|
||||
|
||||
gpgme_set_engine_info @112
|
||||
|
||||
gpgme_ctx_get_engine_info @113
|
||||
gpgme_ctx_set_engine_info @114
|
||||
|
||||
gpgme_data_set_file_name @115
|
||||
gpgme_data_get_file_name @116
|
||||
|
||||
gpgme_sig_notation_clear @117
|
||||
gpgme_sig_notation_add @118
|
||||
gpgme_sig_notation_get @119
|
||||
|
||||
gpgme_free @120
|
||||
|
||||
gpgme_get_giochannel @121
|
||||
; END
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user