]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - crypto/heimdal/packages/debian/patches/022_ftp-roken-glob
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / crypto / heimdal / packages / debian / patches / 022_ftp-roken-glob
1 Index: heimdal-0.7.2/appl/ftp/ftp/cmds.c
2 ===================================================================
3 --- heimdal-0.7.2.orig/appl/ftp/ftp/cmds.c      2005-04-18 17:45:12.000000000 +1000
4 +++ heimdal-0.7.2/appl/ftp/ftp/cmds.c   2006-03-09 12:50:02.997025112 +1100
5 @@ -536,9 +536,17 @@
6  
7         memset(&gl, 0, sizeof(gl));
8         flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
9 +#ifdef HAVE_GLOB
10         if (glob(argv[i], flags, NULL, &gl) || gl.gl_pathc == 0) {
11 +#else
12 +       if (roken_glob(argv[i], flags, NULL, &gl) || gl.gl_pathc == 0) {
13 +#endif 
14             warnx("%s: not found", argv[i]);
15 +#ifdef HAVE_GLOB
16             globfree(&gl);
17 +#else
18 +           roken_globfree(&gl);
19 +#endif
20             continue;
21         }
22         for (cpp = gl.gl_pathv; cpp && *cpp != NULL; cpp++) {
23 @@ -559,7 +567,11 @@
24                 }
25             }
26         }
27 +#ifdef HAVE_GLOB
28         globfree(&gl);
29 +#else
30 +       roken_globfree(&gl);
31 +#endif
32      }
33      signal(SIGINT, oldintr);
34      mflag = 0;
35 @@ -1568,14 +1580,27 @@
36  
37         flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
38         memset(&gl, 0, sizeof(gl));
39 +#ifdef HAVE_GLOB
40         if (glob(*cpp, flags, NULL, &gl) ||
41 +#else 
42 +       if (roken_glob(*cpp, flags, NULL, &gl) ||
43 +#endif
44             gl.gl_pathc == 0) {
45                 warnx("%s: not found", *cpp);
46 +#ifdef HAVE_GLOB
47                 globfree(&gl);
48 +#else
49 +               roken_globfree(&gl);
50 +#endif
51                 return (0);
52         }
53         *cpp = strdup(gl.gl_pathv[0]);  /* XXX - wasted memory */
54 +#ifdef HAVE_GLOB
55         globfree(&gl);
56 +#else
57 +       roken_globfree(&gl);
58 +#endif
59 +
60         return (1);
61  }
62  
63 Index: heimdal-0.7.2/appl/ftp/ftp/ftp_locl.h
64 ===================================================================
65 --- heimdal-0.7.2.orig/appl/ftp/ftp/ftp_locl.h  2002-09-11 06:03:46.000000000 +1000
66 +++ heimdal-0.7.2/appl/ftp/ftp/ftp_locl.h       2006-03-09 12:50:02.998024960 +1100
67 @@ -101,7 +101,11 @@
68  
69  #include <errno.h>
70  #include <ctype.h>
71 +#ifdef HAVE_GLOB
72  #include <glob.h>
73 +#else
74 +#include <roken-glob.h>
75 +#endif 
76  #ifdef HAVE_NETDB_H
77  #include <netdb.h>
78  #endif
79 Index: heimdal-0.7.2/appl/ftp/ftpd/ftpcmd.y
80 ===================================================================
81 --- heimdal-0.7.2.orig/appl/ftp/ftpd/ftpcmd.y   2004-08-20 23:31:19.000000000 +1000
82 +++ heimdal-0.7.2/appl/ftp/ftpd/ftpcmd.y        2006-03-09 12:50:03.000024656 +1100
83 @@ -826,14 +826,22 @@
84                                  GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
85  
86                                 memset(&gl, 0, sizeof(gl));
87 +#ifdef HAVE_GLOB
88                                 if (glob($1, flags, NULL, &gl) ||
89 +#else
90 +                               if (roken_glob($1, flags, NULL, &gl) ||
91 +#endif
92                                     gl.gl_pathc == 0) {
93                                         reply(550, "not found");
94                                         $$ = NULL;
95                                 } else {
96                                         $$ = strdup(gl.gl_pathv[0]);
97                                 }
98 +#ifdef HAVE_GLOB
99                                 globfree(&gl);
100 +#else
101 +                               roken_globfree(&gl);
102 +#endif
103                                 free($1);
104                         } else
105                                 $$ = $1;
106 Index: heimdal-0.7.2/appl/ftp/ftpd/ftpd.c
107 ===================================================================
108 --- heimdal-0.7.2.orig/appl/ftp/ftpd/ftpd.c     2005-06-02 20:41:28.000000000 +1000
109 +++ heimdal-0.7.2/appl/ftp/ftpd/ftpd.c  2006-03-09 12:50:03.003024200 +1100
110 @@ -2234,7 +2234,11 @@
111  
112         memset(&gl, 0, sizeof(gl));
113         freeglob = 1;
114 +#ifdef HAVE_GLOB
115         if (glob(whichf, flags, 0, &gl)) {
116 +#else
117 +       if (roken_glob(whichf, flags, 0, &gl)) {
118 +#endif
119             reply(550, "not found");
120             goto out;
121         } else if (gl.gl_pathc == 0) {
122 @@ -2341,7 +2345,11 @@
123      pdata = -1;
124      if (freeglob) {
125         freeglob = 0;
126 +#ifdef HAVE_GLOB
127         globfree(&gl);
128 +#else
129 +       roken_globfree(&gl);
130 +#endif
131      }
132  }
133  
134 Index: heimdal-0.7.2/appl/ftp/ftpd/ftpd_locl.h
135 ===================================================================
136 --- heimdal-0.7.2.orig/appl/ftp/ftpd/ftpd_locl.h        2005-04-25 05:58:14.000000000 +1000
137 +++ heimdal-0.7.2/appl/ftp/ftpd/ftpd_locl.h     2006-03-09 12:50:03.004024048 +1100
138 @@ -106,7 +106,11 @@
139  #ifdef HAVE_FCNTL_H
140  #include <fcntl.h>
141  #endif
142 +#ifdef HAVE_GLOB
143  #include <glob.h>
144 +#else
145 +#include <roken-glob.h>
146 +#endif 
147  #include <limits.h>
148  #ifdef HAVE_PWD_H
149  #include <pwd.h>
150 Index: heimdal-0.7.2/appl/ftp/ftpd/popen.c
151 ===================================================================
152 --- heimdal-0.7.2.orig/appl/ftp/ftpd/popen.c    2002-04-02 21:57:39.000000000 +1000
153 +++ heimdal-0.7.2/appl/ftp/ftpd/popen.c 2006-03-09 12:50:03.013022680 +1100
154 @@ -55,7 +55,11 @@
155  #include <sys/wait.h>
156  
157  #include <errno.h>
158 +#ifdef HAVE_GLOB
159  #include <glob.h>
160 +#else
161 +#include <roken-glob.h>
162 +#endif
163  #include <signal.h>
164  #include <stdio.h>
165  #include <stdlib.h>
166 @@ -149,7 +153,11 @@
167  
168                 memset(&gl, 0, sizeof(gl));
169                 if (no_glob || 
170 +#ifdef HAVE_GLOB
171                     glob(argv[argc], flags, NULL, &gl) || 
172 +#else
173 +                   roken_glob(argv[argc], flags, NULL, &gl) ||
174 +#endif
175                     gl.gl_pathc == 0)
176                         gargv[gargc++] = strdup(argv[argc]);
177                 else
178 @@ -157,7 +165,11 @@
179                              *pop && gargc < MAXGLOBS - 1;
180                              pop++)
181                                 gargv[gargc++] = strdup(*pop);
182 +#ifdef HAVE_GLOB
183                 globfree(&gl);
184 +#else
185 +               roken_globfree(&gl);
186 +#endif
187         }
188         gargv[gargc] = NULL;
189  
190 Index: heimdal-0.7.2/lib/roken/glob.c
191 ===================================================================
192 --- heimdal-0.7.2.orig/lib/roken/glob.c 2005-04-12 21:28:50.000000000 +1000
193 +++ heimdal-0.7.2/lib/roken/glob.c      2006-03-09 12:50:03.015022376 +1100
194 @@ -87,7 +87,7 @@
195  #include <limits.h>
196  #endif
197  
198 -#include "glob.h"
199 +#include "roken-glob.h"
200  #include "roken.h"
201  
202  #ifndef ARG_MAX
203 @@ -167,7 +167,7 @@
204  #endif
205  
206  int ROKEN_LIB_FUNCTION
207 -glob(const char *pattern, 
208 +roken_glob(const char *pattern, 
209       int flags, 
210       int (*errfunc)(const char *, int), 
211       glob_t *pglob)
212 @@ -742,7 +742,7 @@
213  
214  /* Free allocated data belonging to a glob_t structure. */
215  void ROKEN_LIB_FUNCTION
216 -globfree(glob_t *pglob)
217 +roken_globfree(glob_t *pglob)
218  {
219         int i;
220         char **pp;
221 Index: heimdal-0.7.2/lib/roken/glob.hin
222 ===================================================================
223 --- heimdal-0.7.2.orig/lib/roken/glob.hin       2005-04-13 23:17:56.000000000 +1000
224 +++ heimdal-0.7.2/lib/roken/glob.hin    2006-03-09 12:50:03.016022224 +1100
225 @@ -32,8 +32,8 @@
226   *     @(#)glob.h      8.1 (Berkeley) 6/2/93
227   */
228  
229 -#ifndef _GLOB_H_
230 -#define        _GLOB_H_
231 +#ifndef _ROKEN_GLOB_H_
232 +#define        _ROKEN_GLOB_H_
233  
234  #ifndef ROKEN_LIB_FUNCTION
235  #ifdef _WIN32
236 @@ -88,9 +88,9 @@
237  #define        GLOB_ABEND      (-2)    /* Unignored error. */
238  
239  int ROKEN_LIB_FUNCTION
240 -glob (const char *, int, int (*)(const char *, int), glob_t *);
241 +roken_glob (const char *, int, int (*)(const char *, int), glob_t *);
242  
243  void ROKEN_LIB_FUNCTION
244 -globfree (glob_t *);
245 +roken_globfree (glob_t *);
246  
247 -#endif /* !_GLOB_H_ */
248 +#endif /* !_ROKEN_GLOB_H_ */
249 Index: heimdal-0.7.2/lib/roken/Makefile.am
250 ===================================================================
251 --- heimdal-0.7.2.orig/lib/roken/Makefile.am    2005-05-24 21:39:01.000000000 +1000
252 +++ heimdal-0.7.2/lib/roken/Makefile.am 2006-03-09 12:50:03.016022224 +1100
253 @@ -129,7 +129,7 @@
254  if have_glob_h
255  glob_h =
256  else
257 -glob_h = glob.h
258 +glob_h = roken-glob.h
259  endif
260  
261  if have_ifaddrs_h
262 @@ -170,6 +170,8 @@
263  SUFFIXES += .hin
264  .hin.h:
265         cp $< $@
266 +roken-glob.h:
267 +       cp glob.hin roken-glob.h
268  
269  roken.h: make-roken$(EXEEXT)
270         @./make-roken$(EXEEXT) > tmp.h ;\