diff options
author | Werner Koch <[email protected]> | 2011-02-04 11:57:53 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2011-02-04 11:57:53 +0000 |
commit | b008274afdbe375b32a7e66dbd073e200f6f0587 (patch) | |
tree | 219e239d39cf06be3f03aa82fb572080ac163a15 /sm/server.c | |
parent | Let autogen.sh check the git config (diff) | |
download | gnupg-b008274afdbe375b32a7e66dbd073e200f6f0587.tar.gz gnupg-b008274afdbe375b32a7e66dbd073e200f6f0587.zip |
Nuked almost all trailing white space.post-nuke-of-trailing-ws
We better do this once and for all instead of cluttering all future
commits with diffs of trailing white spaces. In the majority of cases
blank or single lines are affected and thus this change won't disturb
a git blame too much. For future commits the pre-commit scripts
checks that this won't happen again.
Diffstat (limited to 'sm/server.c')
-rw-r--r-- | sm/server.c | 101 |
1 files changed, 49 insertions, 52 deletions
diff --git a/sm/server.c b/sm/server.c index 6eaadd768..19c4a1678 100644 --- a/sm/server.c +++ b/sm/server.c @@ -1,4 +1,4 @@ -/* server.c - Server mode and main entry point +/* server.c - Server mode and main entry point * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, * 2010 Free Software Foundation, Inc. * @@ -81,7 +81,7 @@ strcpy_escaped_plus (char *d, const char *s) while (*s) { if (*s == '%' && s[1] && s[2]) - { + { s++; *d++ = xtoi_2 (s); s += 2; @@ -91,11 +91,11 @@ strcpy_escaped_plus (char *d, const char *s) else *d++ = *s++; } - *d = 0; + *d = 0; } -/* Skip over options. +/* Skip over options. Blanks after the options are also removed. */ static char * skip_options (const char *line) @@ -158,7 +158,7 @@ data_line_cookie_close (void *cookie) } -static void +static void close_message_fd (ctrl_t ctrl) { if (ctrl->server_local->message_fd != -1) @@ -180,7 +180,7 @@ start_audit_session (ctrl_t ctrl) ctrl->audit = NULL; if (ctrl->server_local->enable_audit_log && !(ctrl->audit = audit_new ()) ) return gpg_error_from_syserror (); - + return 0; } @@ -338,9 +338,9 @@ input_notify (assuan_context_t ctx, char *line) ctrl->is_pem = 0; ctrl->is_base64 = 0; if (strstr (line, "--armor")) - ctrl->is_pem = 1; + ctrl->is_pem = 1; else if (strstr (line, "--base64")) - ctrl->is_base64 = 1; + ctrl->is_base64 = 1; else if (strstr (line, "--binary")) ; else @@ -356,14 +356,14 @@ output_notify (assuan_context_t ctx, char *line) ctrl->create_pem = 0; ctrl->create_base64 = 0; if (strstr (line, "--armor")) - ctrl->create_pem = 1; + ctrl->create_pem = 1; else if (strstr (line, "--base64")) ctrl->create_base64 = 1; /* just the raw output */ return 0; } -static const char hlp_recipient[] = +static const char hlp_recipient[] = "RECIPIENT <userID>\n" "\n" "Set the recipient for the encryption. USERID shall be the\n" @@ -399,7 +399,7 @@ cmd_recipient (assuan_context_t ctx, char *line) } -static const char hlp_signer[] = +static const char hlp_signer[] = "SIGNER <userID>\n" "\n" "Set the signer's keys for the signature creation. USERID should\n" @@ -423,18 +423,18 @@ cmd_signer (assuan_context_t ctx, char *line) &ctrl->server_local->signerlist, 0); if (rc) { - gpgsm_status2 (ctrl, STATUS_INV_SGNR, + gpgsm_status2 (ctrl, STATUS_INV_SGNR, get_inv_recpsgnr_code (rc), line, NULL); /* For compatibiliy reasons we also issue the old code after the new one. */ - gpgsm_status2 (ctrl, STATUS_INV_RECP, + gpgsm_status2 (ctrl, STATUS_INV_RECP, get_inv_recpsgnr_code (rc), line, NULL); } return rc; } -static const char hlp_encrypt[] = +static const char hlp_encrypt[] = "ENCRYPT \n" "\n" "Do the actual encryption process. Takes the plaintext from the INPUT\n" @@ -469,7 +469,7 @@ cmd_encrypt (assuan_context_t ctx, char *line) out_fp = es_fdopen_nc (out_fd, "w"); if (!out_fp) return set_error (gpg_err_code_from_syserror (), "fdopen() failed"); - + /* Now add all encrypt-to marked recipients from the default list. */ rc = 0; @@ -498,7 +498,7 @@ cmd_encrypt (assuan_context_t ctx, char *line) } -static const char hlp_decrypt[] = +static const char hlp_decrypt[] = "DECRYPT\n" "\n" "This performs the decrypt operation after doing some check on the\n" @@ -529,7 +529,7 @@ cmd_decrypt (assuan_context_t ctx, char *line) rc = start_audit_session (ctrl); if (!rc) - rc = gpgsm_decrypt (ctrl, inp_fd, out_fp); + rc = gpgsm_decrypt (ctrl, inp_fd, out_fp); es_fclose (out_fp); /* Close and reset the fds. */ @@ -541,7 +541,7 @@ cmd_decrypt (assuan_context_t ctx, char *line) } -static const char hlp_verify[] = +static const char hlp_verify[] = "VERIFY\n" "\n" "This does a verify operation on the message send to the input FD.\n" @@ -586,7 +586,7 @@ cmd_verify (assuan_context_t ctx, char *line) } -static const char hlp_sign[] = +static const char hlp_sign[] = "SIGN [--detached]\n" "\n" "Sign the data set with the INPUT command and write it to the sink\n" @@ -608,7 +608,7 @@ cmd_sign (assuan_context_t ctx, char *line) if (out_fd == -1) return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL); - detached = has_option (line, "--detached"); + detached = has_option (line, "--detached"); out_fp = es_fdopen_nc (out_fd, "w"); if (!out_fp) @@ -629,7 +629,7 @@ cmd_sign (assuan_context_t ctx, char *line) } -static const char hlp_import[] = +static const char hlp_import[] = "IMPORT [--re-import]\n" "\n" "Import the certificates read form the input-fd, return status\n" @@ -647,7 +647,7 @@ cmd_import (assuan_context_t ctx, char *line) ctrl_t ctrl = assuan_get_pointer (ctx); int rc; int fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0); - int reimport = has_option (line, "--re-import"); + int reimport = has_option (line, "--re-import"); (void)line; @@ -680,7 +680,7 @@ cmd_export (assuan_context_t ctx, char *line) char *p; strlist_t list, sl; int use_data; - + use_data = has_option (line, "--data"); if (use_data) @@ -723,7 +723,7 @@ cmd_export (assuan_context_t ctx, char *line) if (!stream) { free_strlist (list); - return set_error (GPG_ERR_ASS_GENERAL, + return set_error (GPG_ERR_ASS_GENERAL, "error setting up a data stream"); } gpgsm_export (ctrl, list, stream); @@ -745,7 +745,7 @@ cmd_export (assuan_context_t ctx, char *line) free_strlist (list); return set_error (gpg_err_code_from_syserror (), "fdopen() failed"); } - + gpgsm_export (ctrl, list, out_fp); es_fclose (out_fp); } @@ -859,7 +859,7 @@ cmd_message (assuan_context_t ctx, char *line) -static const char hlp_listkeys[] = +static const char hlp_listkeys[] = "LISTKEYS [<patterns>]\n" "LISTSECRETKEYS [<patterns>]\n" "DUMPKEYS [<patterns>]\n" @@ -887,7 +887,7 @@ static const char hlp_listkeys[] = "\n" " \"list-to-output\" set to true: Write output to the file descriptor\n" " given by the last \"OUTPUT\" command."; -static int +static int do_listkeys (assuan_context_t ctx, char *line, int mode) { ctrl_t ctrl = assuan_get_pointer (ctx); @@ -934,12 +934,12 @@ do_listkeys (assuan_context_t ctx, char *line, int mode) { fp = es_fopencookie (ctx, "w", data_line_cookie_functions); if (!fp) - return set_error (GPG_ERR_ASS_GENERAL, + return set_error (GPG_ERR_ASS_GENERAL, "error setting up a data stream"); } - + ctrl->with_colons = 1; - listmode = mode; + listmode = mode; if (ctrl->server_local->list_internal) listmode |= (1<<6); if (ctrl->server_local->list_external) @@ -1040,8 +1040,8 @@ cmd_getauditlog (assuan_context_t ctx, char *line) int opt_data, opt_html; int rc; - opt_data = has_option (line, "--data"); - opt_html = has_option (line, "--html"); + opt_data = has_option (line, "--data"); + opt_html = has_option (line, "--html"); line = skip_options (line); if (!ctrl->audit) @@ -1051,7 +1051,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line) { out_stream = es_fopencookie (ctx, "w", data_line_cookie_functions); if (!out_stream) - return set_error (GPG_ERR_ASS_GENERAL, + return set_error (GPG_ERR_ASS_GENERAL, "error setting up a data stream"); } else @@ -1059,7 +1059,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line) out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1); if (out_fd == -1) return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL); - + out_stream = es_fdopen_nc (out_fd, "w"); if (!out_stream) { @@ -1078,7 +1078,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line) return rc; } -static const char hlp_getinfo[] = +static const char hlp_getinfo[] = "GETINFO <what>\n" "\n" "Multipurpose function to return a variety of information.\n" @@ -1169,7 +1169,7 @@ cmd_passwd (assuan_context_t ctx, char *line) ; else if (!(grip = gpgsm_get_keygrip_hexstring (cert))) err = gpg_error (GPG_ERR_INTERNAL); - else + else { char *desc = gpgsm_format_keydesc (cert); err = gpgsm_agent_passwd (ctrl, grip, desc); @@ -1193,7 +1193,7 @@ command_has_option (const char *cmd, const char *cmdopt) if (!strcmp (cmdopt, "re-import")) return 1; } - + return 0; } @@ -1215,8 +1215,8 @@ register_commands (assuan_context_t ctx) { "SIGN", cmd_sign, hlp_sign }, { "IMPORT", cmd_import, hlp_import }, { "EXPORT", cmd_export, hlp_export }, - { "INPUT", NULL, hlp_input }, - { "OUTPUT", NULL, hlp_output }, + { "INPUT", NULL, hlp_input }, + { "OUTPUT", NULL, hlp_output }, { "MESSAGE", cmd_message, hlp_message }, { "LISTKEYS", cmd_listkeys, hlp_listkeys }, { "DUMPKEYS", cmd_dumpkeys, hlp_listkeys }, @@ -1237,7 +1237,7 @@ register_commands (assuan_context_t ctx) table[i].help); if (rc) return rc; - } + } return 0; } @@ -1340,7 +1340,7 @@ gpgsm_server (certlist_t default_recplist) log_info ("Assuan accept problem: %s\n", gpg_strerror (rc)); break; } - + rc = assuan_process (ctx); if (rc) { @@ -1384,40 +1384,40 @@ gpgsm_status2 (ctrl_t ctrl, int no, ...) statusfp = stderr; else statusfp = fdopen (ctrl->status_fd, "w"); - + if (!statusfp) { log_fatal ("can't open fd %d for status output: %s\n", ctrl->status_fd, strerror(errno)); } } - + fputs ("[GNUPG:] ", statusfp); fputs (get_status_string (no), statusfp); - + while ( (text = va_arg (arg_ptr, const char*) )) { putc ( ' ', statusfp ); - for (; *text; text++) + for (; *text; text++) { if (*text == '\n') fputs ( "\\n", statusfp ); else if (*text == '\r') fputs ( "\\r", statusfp ); - else + else putc ( *(const byte *)text, statusfp ); } } putc ('\n', statusfp); fflush (statusfp); } - else + else { assuan_context_t ctx = ctrl->server_local->assuan_ctx; char buf[950], *p; size_t n; - p = buf; + p = buf; n = 0; while ( (text = va_arg (arg_ptr, const char *)) ) { @@ -1463,11 +1463,8 @@ gpgsm_status_with_err_code (ctrl_t ctrl, int no, const char *text, gpg_error_t gpgsm_proxy_pinentry_notify (ctrl_t ctrl, const unsigned char *line) { - if (!ctrl || !ctrl->server_local + if (!ctrl || !ctrl->server_local || !ctrl->server_local->allow_pinentry_notify) return 0; return assuan_inquire (ctrl->server_local->assuan_ctx, line, NULL, NULL, 0); } - - - |