X-Git-Url: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blobdiff_plain;f=sm%2Fserver.c;h=d6a2dbbddb0a94ccb3c11d1d47fd2ed9e55f2a14;hp=e47861b4354301b8dfeb5e1be61f087072a9e29e;hb=a55393cb5f4b331cb3a715c7d9a8b91f7606f337;hpb=a9e0905342e847e8961ec4fe9b3aaedf05e33423
diff --git a/sm/server.c b/sm/server.c
index e47861b43..d6a2dbbdd 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -15,7 +15,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, see .
+ * along with this program; if not, see .
*/
#include
@@ -30,6 +30,7 @@
#include "gpgsm.h"
#include
#include "sysutils.h"
+#include "server-help.h"
#define set_error(e,t) assuan_set_error (ctx, gpg_error (e), (t))
@@ -55,8 +56,8 @@ struct server_local_s {
/* Cookie definition for assuan data line output. */
-static ssize_t data_line_cookie_write (void *cookie,
- const void *buffer, size_t size);
+static gpgrt_ssize_t data_line_cookie_write (void *cookie,
+ const void *buffer, size_t size);
static int data_line_cookie_close (void *cookie);
static es_cookie_io_functions_t data_line_cookie_functions =
{
@@ -95,41 +96,9 @@ strcpy_escaped_plus (char *d, const char *s)
}
-/* Skip over options.
- Blanks after the options are also removed. */
-static char *
-skip_options (const char *line)
-{
- while (spacep (line))
- line++;
- while ( *line == '-' && line[1] == '-' )
- {
- while (*line && !spacep (line))
- line++;
- while (spacep (line))
- line++;
- }
- return (char*)line;
-}
-
-
-/* Check whether the option NAME appears in LINE */
-static int
-has_option (const char *line, const char *name)
-{
- const char *s;
- int n = strlen (name);
-
- s = strstr (line, name);
- if (s && s >= skip_options (line))
- return 0;
- return (s && (s == line || spacep (s-1)) && (!s[n] || spacep (s+n)));
-}
-
-
/* A write handler used by es_fopencookie to write assuan data
lines. */
-static ssize_t
+static gpgrt_ssize_t
data_line_cookie_write (void *cookie, const void *buffer, size_t size)
{
assuan_context_t ctx = cookie;
@@ -140,7 +109,7 @@ data_line_cookie_write (void *cookie, const void *buffer, size_t size)
return -1;
}
- return size;
+ return (gpgrt_ssize_t)size;
}
static int
@@ -1070,7 +1039,7 @@ static const char hlp_getauditlog[] =
"If --data is used, the output is send using D-lines and not to the\n"
"file descriptor given by an OUTPUT command.\n"
"\n"
- "If --html is used the output is formated as an XHTML block. This is\n"
+ "If --html is used the output is formatted as an XHTML block. This is\n"
"designed to be incorporated into a HTML document.";
static gpg_error_t
cmd_getauditlog (assuan_context_t ctx, char *line)
@@ -1083,7 +1052,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
opt_data = has_option (line, "--data");
opt_html = has_option (line, "--html");
- line = skip_options (line);
+ /* Not needed: line = skip_options (line); */
if (!ctrl->audit)
return gpg_error (GPG_ERR_NO_DATA);
@@ -1130,7 +1099,7 @@ static const char hlp_getinfo[] =
" agent-check - Return success if the agent is running.\n"
" cmd_has_option CMD OPT\n"
" - Returns OK if the command CMD implements the option OPT.\n"
- " offline - Returns OK if the conenction is in offline mode.";
+ " offline - Returns OK if the connection is in offline mode.";
static gpg_error_t
cmd_getinfo (assuan_context_t ctx, char *line)
{
@@ -1339,7 +1308,7 @@ gpgsm_server (certlist_t default_recplist)
}
if (opt.verbose || opt.debug)
{
- char *tmp = NULL;
+ char *tmp;
/* Fixme: Use the really used socket name. */
if (asprintf (&tmp,
@@ -1347,11 +1316,9 @@ gpgsm_server (certlist_t default_recplist)
"Config: %s\n"
"DirmngrInfo: %s\n"
"%s",
- opt.homedir,
+ gnupg_homedir (),
opt.config_filename,
- (dirmngr_user_socket_name ()
- ? dirmngr_user_socket_name ()
- : dirmngr_sys_socket_name ()),
+ dirmngr_socket_name (),
hello) > 0)
{
assuan_set_hello_line (ctx, tmp);