]> git.pld-linux.org Git - packages/sane-backends.git/blob - sane-backends-saned.patch
- updated to 1.0.17, updated pl.po-update,link patches
[packages/sane-backends.git] / sane-backends-saned.patch
1 --- sane-backends-1.0.8/sanei/sanei_wire.c.saned        2002-03-21 00:17:06.000000000 +0000
2 +++ sane-backends-1.0.8/sanei/sanei_wire.c      2003-09-11 12:31:30.000000000 +0100
3 @@ -192,8 +192,14 @@
4      len = *len_ptr;
5    DBG (4, "sanei_w_array: send/receive array length\n");
6    sanei_w_word (w, &len);
7 -  DBG (4, "sanei_w_array: array has %d elements\n", len);
8  
9 +  if (w->status)
10 +    {
11 +      DBG (1, "sanei_w_array: bad status: %d\n", w->status);
12 +      return;
13 +    }
14 +  DBG (4, "sanei_w_array: array has %d elements\n", len);
15 +      
16    if (w->direction == WIRE_DECODE)
17      {
18        *len_ptr = len;
19 @@ -219,6 +225,11 @@
20      {
21        (*w_element) (w, val);
22        val += element_size;
23 +      if (w->status)
24 +       {
25 +         DBG (1, "sanei_w_array: bad status: %d\n", w->status);
26 +         return;
27 +       }
28      }
29    DBG (4, "sanei_w_array: done\n");
30  }
31 @@ -251,6 +262,11 @@
32  
33    DBG (4, "sanei_w_ptr: send/receive is_null\n");
34    sanei_w_word (w, &is_null);
35 +  if (w->status)
36 +    {
37 +      DBG (1, "sanei_w_ptr: bad status: %d\n", w->status);
38 +      return;
39 +    }
40  
41    if (!is_null)
42      {
43 @@ -307,7 +323,7 @@
44  {
45    DBG (3, "sanei_w_string: wire %d\n", w->io.fd);
46    (*w->codec.w_string) (w, v);
47 -  if (w->direction != WIRE_FREE)
48 +  if (w->direction != WIRE_FREE && w->status == 0)
49      DBG (4, "sanei_w_string: value = %s\n", *v);
50  }
51  
52 --- sane-backends-1.0.8/sanei/sanei_codec_bin.c.saned   2001-05-14 22:55:52.000000000 +0100
53 +++ sane-backends-1.0.8/sanei/sanei_codec_bin.c 2003-09-11 12:31:30.000000000 +0100
54 @@ -54,6 +54,9 @@
55    SANE_Byte *b = v;
56  
57    sanei_w_space (w, 1);
58 +  if (w->status)
59 +    return;
60 +
61    switch (w->direction)
62      {
63      case WIRE_ENCODE:
64 @@ -82,8 +85,14 @@
65         len = strlen (*s) + 1;
66      }
67    sanei_w_array (w, &len, v, w->codec.w_byte, 1);
68 -  if (w->direction == WIRE_DECODE && !len)
69 -    *s = 0;
70 +
71 +  if (w->direction == WIRE_DECODE)
72 +    {
73 +      if (len == 0)
74 +       *s = 0;
75 +      else if (w->status == 0)
76 +       *(*s + len - 1) = '\0';
77 +    }
78  }
79  
80  static void
81 @@ -92,6 +101,8 @@
82    SANE_Word val, *word = v;
83  
84    sanei_w_space (w, 4);
85 +  if (w->status)
86 +    return;
87    switch (w->direction)
88      {
89      case WIRE_ENCODE:
90 --- sane-backends-1.0.8/frontend/saned.c.saned  2002-02-16 18:10:26.000000000 +0000
91 +++ sane-backends-1.0.8/frontend/saned.c        2003-09-11 12:31:30.000000000 +0100
92 @@ -183,6 +183,12 @@
93        return;
94      }
95  
96 +  if (wire.status)
97 +    {
98 +      DBG(DBG_ERR, "auth_callback: bad status %d\n", wire.status);
99 +      return;
100 +    }
101 +
102    switch (current_request)
103      {
104      case SANE_NET_OPEN:
105 @@ -222,10 +228,24 @@
106            current_request, res);
107        break;
108      }
109 +
110 +  if (wire.status)
111 +    {
112 +      DBG(DBG_ERR, "auth_callback: bad status %d\n", wire.status);
113 +      return;
114 +    }
115 +
116    reset_watchdog ();
117  
118    sanei_w_set_dir (&wire, WIRE_DECODE);
119    sanei_w_word (&wire, &word);
120 +
121 +  if (wire.status)
122 +    {
123 +      DBG(DBG_ERR, "auth_callback: bad status %d\n", wire.status);
124 +      return;
125 +    }
126 +
127    procnum = word;
128    if (procnum != SANE_NET_AUTHORIZE)
129      {
130 @@ -237,6 +257,12 @@
131      }
132  
133    sanei_w_authorization_req (&wire, &req);
134 +  if (wire.status)
135 +    {
136 +      DBG(DBG_ERR, "auth_callback: bad status %d\n", wire.status);
137 +      return;
138 +    }
139 +
140    if (req.username)
141      strcpy (username, req.username);
142    if (req.password)
143 @@ -514,30 +540,51 @@
144  
145    reset_watchdog ();
146  
147 +  status = check_host (w->io.fd);
148 +  if (status != SANE_STATUS_GOOD)
149 +    {
150 +      DBG (DBG_WARN, "init: access by host %s denied\n", remote_hostname);
151 +      return -1;
152 +    }
153 +
154    sanei_w_set_dir (w, WIRE_DECODE);
155 +  if (w->status)
156 +    {
157 +      DBG (DBG_ERR, "init: bad status after sanei_w_set_dir: %d\n", w->status);
158 +      return -1;
159 +    }
160 +  
161    sanei_w_word (w, &word);     /* decode procedure number */
162 -  sanei_w_init_req (w, &req);
163 -  w->version = SANEI_NET_PROTOCOL_VERSION;
164 -
165    if (w->status || word != SANE_NET_INIT)
166      {
167        DBG (DBG_ERR, "init: bad status=%d or procnum=%d\n",
168            w->status, word);
169        return -1;
170      }
171 +
172 +  sanei_w_init_req (w, &req);
173 +  if (w->status)
174 +    {
175 +      DBG (DBG_ERR, "init: bad status after sanei_w_init_req: %d\n", w->status);
176 +      return -1;
177 +    }
178 +
179 +  w->version = SANEI_NET_PROTOCOL_VERSION;
180    if (req.username)
181      default_username = strdup (req.username);
182  
183    sanei_w_free (w, (WireCodecFunc) sanei_w_init_req, &req);
184 +  if (w->status)
185 +    {
186 +      DBG (DBG_ERR, "init: bad status after sanei_w_free: %d\n", w->status);
187 +      return -1;
188 +    }
189  
190    reply.version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR,
191                                           SANEI_NET_PROTOCOL_VERSION);
192  
193 -  status = check_host (w->io.fd);
194 -
195 -  DBG (DBG_WARN, "init: access by %s@%s %s\n",
196 -       default_username, remote_hostname,
197 -       (status == SANE_STATUS_GOOD) ? "accepted" : "rejected");
198 +  DBG (DBG_WARN, "init: access by %s@%s accepted\n",
199 +       default_username, remote_hostname);
200  
201    if (status == SANE_STATUS_GOOD)
202      {
203 @@ -823,6 +870,14 @@
204    DBG (DBG_DBG, "process_request: waiting for request\n");
205    sanei_w_set_dir (w, WIRE_DECODE);
206    sanei_w_word (w, &word);     /* decode procedure number */
207 +
208 +  if (w->status)
209 +    {
210 +      DBG (DBG_ERR,
211 +          "process_request: bad status %d\n", w->status);
212 +      quit (0);
213 +    }
214 +
215    current_request = word;
216  
217    DBG (DBG_MSG, "process_request: got request %d\n", current_request);
This page took 0.077762 seconds and 3 git commands to generate.