~ubuntu-branches/ubuntu/jaunty/gnupg2/jaunty-security

« back to all changes in this revision

Viewing changes to assuan/assuan-defs.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* assuan-defs.c - Internal definitions to Assuan
2
 
 *      Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3
 
 *
4
 
 * This file is part of Assuan.
5
 
 *
6
 
 * Assuan is free software; you can redistribute it and/or modify it
7
 
 * under the terms of the GNU Lesser General Public License as
8
 
 * published by the Free Software Foundation; either version 2.1 of
9
 
 * the License, or (at your option) any later version.
10
 
 *
11
 
 * Assuan is distributed in the hope that it will be useful, but
12
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Lesser General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Lesser General Public
17
 
 * License along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 
19
 
 */
20
 
 
21
 
#ifndef ASSUAN_DEFS_H
22
 
#define ASSUAN_DEFS_H
23
 
 
24
 
#include <sys/types.h>
25
 
#include "assuan.h"
26
 
 
27
 
#define LINELENGTH ASSUAN_LINELENGTH
28
 
 
29
 
struct cmdtbl_s {
30
 
  const char *name;
31
 
  int cmd_id;
32
 
  int (*handler)(ASSUAN_CONTEXT, char *line);
33
 
};
34
 
 
35
 
struct assuan_context_s {
36
 
  AssuanError err_no;
37
 
  const char *err_str;
38
 
  int os_errno;  /* last system error number used with certain error codes*/
39
 
 
40
 
  int confidential;
41
 
  int is_server;  /* set if this is context belongs to a server */
42
 
  int in_inquire;
43
 
  char *hello_line;
44
 
  char *okay_line; /* see assan_set_okay_line() */
45
 
  
46
 
  void *user_pointer;  /* for assuan_[gs]et_pointer () */
47
 
 
48
 
  FILE *log_fp;
49
 
 
50
 
  struct {
51
 
    int fd;
52
 
    int eof;
53
 
    char line[LINELENGTH];
54
 
    int linelen;  /* w/o CR, LF - might not be the same as
55
 
                     strlen(line) due to embedded nuls. However a nul
56
 
                     is always written at this pos */
57
 
    struct {
58
 
      char line[LINELENGTH];
59
 
      int linelen ;
60
 
      int pending; /* i.e. at least one line is available in the attic */
61
 
    } attic;
62
 
  } inbound;
63
 
 
64
 
  struct {
65
 
    int fd;
66
 
    struct {
67
 
      FILE *fp;
68
 
      char line[LINELENGTH];
69
 
      int linelen; 
70
 
      int error;
71
 
    } data; 
72
 
  } outbound;
73
 
 
74
 
  int pipe_mode;  /* We are in pipe mode, i.e. we can handle just one
75
 
                     connection and must terminate then */
76
 
  pid_t pid;      /* In pipe mode, the pid of the child server process.  
77
 
                     In socket mode, the pid of the server */
78
 
  int listen_fd;  /* The fd we are listening on (used by socket servers) */
79
 
  int connected_fd; /* helper */
80
 
 
81
 
  pid_t client_pid; /* for a socket server the PID of the client or -1
82
 
                       if not available */
83
 
 
84
 
  void (*deinit_handler)(ASSUAN_CONTEXT);  
85
 
  int (*accept_handler)(ASSUAN_CONTEXT);
86
 
  int (*finish_handler)(ASSUAN_CONTEXT);
87
 
 
88
 
  struct cmdtbl_s *cmdtbl;
89
 
  size_t cmdtbl_used; /* used entries */
90
 
  size_t cmdtbl_size; /* allocated size of table */
91
 
 
92
 
  void (*bye_notify_fnc)(ASSUAN_CONTEXT);
93
 
  void (*reset_notify_fnc)(ASSUAN_CONTEXT);
94
 
  void (*cancel_notify_fnc)(ASSUAN_CONTEXT);
95
 
  int  (*option_handler_fnc)(ASSUAN_CONTEXT,const char*, const char*);
96
 
  void (*input_notify_fnc)(ASSUAN_CONTEXT, const char *);
97
 
  void (*output_notify_fnc)(ASSUAN_CONTEXT, const char *);
98
 
 
99
 
  int input_fd;   /* set by INPUT command */
100
 
  int output_fd;  /* set by OUTPUT command */
101
 
 
102
 
};
103
 
 
104
 
 
105
 
 
106
 
/*-- assuan-pipe-server.c --*/
107
 
int _assuan_new_context (ASSUAN_CONTEXT *r_ctx);
108
 
void _assuan_release_context (ASSUAN_CONTEXT ctx);
109
 
 
110
 
 
111
 
/*-- assuan-handler.c --*/
112
 
int _assuan_register_std_commands (ASSUAN_CONTEXT ctx);
113
 
 
114
 
/*-- assuan-buffer.c --*/
115
 
int _assuan_read_line (ASSUAN_CONTEXT ctx);
116
 
int _assuan_cookie_write_data (void *cookie, const char *buffer, size_t size);
117
 
int _assuan_cookie_write_flush (void *cookie);
118
 
 
119
 
/*-- assuan-client.c --*/
120
 
AssuanError _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off);
121
 
 
122
 
 
123
 
/*-- assuan-util.c --*/
124
 
extern ssize_t (*_assuan_read_wrapper)(int,void*,size_t);
125
 
extern ssize_t (*_assuan_write_wrapper)(int,const void*,size_t);
126
 
 
127
 
void *_assuan_malloc (size_t n);
128
 
void *_assuan_calloc (size_t n, size_t m);
129
 
void *_assuan_realloc (void *p, size_t n);
130
 
void  _assuan_free (void *p);
131
 
 
132
 
#define xtrymalloc(a)    _assuan_malloc ((a))
133
 
#define xtrycalloc(a,b)  _assuan_calloc ((a),(b))
134
 
#define xtryrealloc(a,b) _assuan_realloc((a),(b))
135
 
#define xfree(a)         _assuan_free ((a))
136
 
 
137
 
#define set_error(c,e,t) assuan_set_error ((c), ASSUAN_ ## e, (t))
138
 
 
139
 
void _assuan_log_print_buffer (FILE *fp, const void *buffer, size_t  length);
140
 
void _assuan_log_sanitized_string (const char *string);
141
 
 
142
 
 
143
 
#endif /*ASSUAN_DEFS_H*/
144