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