Files
heimdal/packages/debian/patches/022_ftp-roken-glob
Love Hörnquist Åstrand cc8a62e402 from ubuntu 7.10
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21994 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-10-19 14:30:24 +00:00

271 lines
6.8 KiB
Plaintext

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 ;\