summaryrefslogtreecommitdiffstats
path: root/krb5-1.7-largefile.patch
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@fedoraproject.org>2009-07-06 22:54:34 +0000
committerNalin Dahyabhai <nalin@fedoraproject.org>2009-07-06 22:54:34 +0000
commit9e296310c6fdbfc879170e01ca3daf0aded2a9d9 (patch)
tree2697788857b6b73b7749a4e66852fbb0b6fd55e5 /krb5-1.7-largefile.patch
parent6f1fb7d51ed07120db8e2d5a98aaadde2198e7d3 (diff)
downloadkrb5-9e296310c6fdbfc879170e01ca3daf0aded2a9d9.tar.gz
krb5-9e296310c6fdbfc879170e01ca3daf0aded2a9d9.tar.xz
krb5-9e296310c6fdbfc879170e01ca3daf0aded2a9d9.zip
- catch the case of ftpd printing file sizes using %i, when they might be
bigger than an int now
Diffstat (limited to 'krb5-1.7-largefile.patch')
-rw-r--r--krb5-1.7-largefile.patch260
1 files changed, 152 insertions, 108 deletions
diff --git a/krb5-1.7-largefile.patch b/krb5-1.7-largefile.patch
index 75b3b06..ed4cdc3 100644
--- a/krb5-1.7-largefile.patch
+++ b/krb5-1.7-largefile.patch
@@ -1,12 +1,18 @@
-Turn on large file support in gssftp and rcp. The size of off_t might
-be more than that of a long, so if we have a "long long" type, assume
-that format specifiers for it work correctly and that we need to
-represent off_t values as such.
-
-diff -up krb5/src/appl/gssftp/configure.in krb5/src/appl/gssftp/configure.in
---- krb5/src/appl/gssftp/configure.in 2009-06-29 17:49:43.000000000 -0400
-+++ krb5/src/appl/gssftp/configure.in 2009-06-29 17:49:36.000000000 -0400
-@@ -12,6 +12,9 @@ DECLARE_SYS_ERRLIST
+* Turn on large file support in gssftp and rcp (and the rest of the bsd
+ applications) using AC_SYS_LARGEFILE.
+* The size of off_t might now be greater than that of an int or a long, so
+ if we have a "long long" type, assume that format specifiers for it work
+ correctly and that we can cast off_t values to long long for displaying
+ and logging.
+* Check for fseeko(), which takes an off_t, and if we find it, use it
+ instead of fseek(), which takes a long and might not handle the full
+ range of values.
+RT#TBD
+Index: krb5/src/appl/gssftp/configure.in
+===================================================================
+--- krb5/src/appl/gssftp/configure.in (revision 22425)
++++ krb5/src/appl/gssftp/configure.in (working copy)
+@@ -12,6 +12,9 @@
AC_HEADER_STDARG
AC_CHECK_HEADER(termios.h,[AC_CHECK_FUNC(cfsetispeed,AC_DEFINE(POSIX_TERMIOS,1,[Define if POSIX termios interface found]))])
AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/select.h sys/sockio.h paths.h)
@@ -16,75 +22,11 @@ diff -up krb5/src/appl/gssftp/configure.in krb5/src/appl/gssftp/configure.in
CHECK_UTMP
DECLARE_SYS_ERRLIST
AC_REPLACE_FUNCS(getdtablesize)
---- krb5/src/appl/gssftp/ftpd/ftpcmd.y
-+++ krb5/src/appl/gssftp/ftpd/ftpcmd.y
-@@ -1515,12 +1515,20 @@
- (stbuf.st_mode&S_IFMT) != S_IFREG)
- reply(550, "%s: not a plain file.", filename);
- else
-+#ifdef HAVE_LONG_LONG
-+ reply(213, "%llu", (long long) stbuf.st_size);
-+#else
- reply(213, "%lu", (long) stbuf.st_size);
-+#endif
- break;}
- case TYPE_A: {
- FILE *fin;
- register int c;
-+#ifdef HAVE_LONG_LONG
-+ register long long count;
-+#else
- register long count;
-+#endif
- struct stat stbuf;
- fin = fopen(filename, "r");
- if (fin == NULL) {
-@@ -1542,7 +1542,11 @@
- }
- (void) fclose(fin);
-
-+#ifdef HAVE_LONG_LONG
-+ reply(213, "%lld", count);
-+#else
- reply(213, "%ld", count);
-+#endif
- break;}
- default:
- reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
-diff -up krb5/src/appl/bsd/configure.in krb5-1.7/src/appl/bsd/configure.in
---- krb5/src/appl/bsd/configure.in 2009-06-04 14:02:56.000000000 -0400
-+++ krb5/src/appl/bsd/configure.in 2009-06-04 14:02:56.000000000 -0400
-@@ -53,6 +53,9 @@ AC_FUNC_VFORK
- AC_TYPE_MODE_T
- AC_CHECK_FUNCS(isatty inet_aton getenv gettosbyname killpg initgroups setpriority setreuid setresuid waitpid setsid ptsname setlogin tcgetpgrp tcsetpgrp setpgid strsave utimes rmufile rresvport_af)
- AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h utmp.h sys/time.h sys/ioctl_compat.h paths.h arpa/nameser.h)
-+AC_SYS_LARGEFILE
-+AC_FUNC_FSEEKO
-+AC_CHECK_TYPES([long long])
- AC_HEADER_STDARG
- AC_REPLACE_FUNCS(getdtablesize)
- dnl
-diff -up krb5/src/appl/bsd/krcp.c krb5-1.7/src/appl/bsd/krcp.c
---- krb5/src/appl/bsd/krcp.c 2008-12-15 15:29:01.000000000 -0500
-+++ krb5/src/appl/bsd/krcp.c 2009-06-04 14:02:56.000000000 -0400
-@@ -764,8 +764,13 @@ void source(argc, argv)
- continue;
- }
- }
-+#ifdef HAVE_LONG_LONG
-+ (void) snprintf(buf, sizeof(buf), "C%04o %lld %s\n",
-+ (int) stb.st_mode&07777, (long long) stb.st_size, last);
-+#else
- (void) snprintf(buf, sizeof(buf), "C%04o %ld %s\n",
- (int) stb.st_mode&07777, (long ) stb.st_size, last);
-+#endif
- (void) rcmd_stream_write(rem, buf, strlen(buf), 0);
- if (response() < 0) {
- (void) close(f);
-diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
---- krb5/src/appl/gssftp/ftp/ftp_var.h 2009-06-29 18:01:55.000000000 -0400
-+++ krb5/src/appl/gssftp/ftp/ftp_var.h 2009-06-29 18:03:05.000000000 -0400
-@@ -46,12 +46,18 @@ FILE* fdopen_socket(SOCKET s, char* mode
+Index: krb5/src/appl/gssftp/ftp/ftp_var.h
+===================================================================
+--- krb5/src/appl/gssftp/ftp/ftp_var.h (revision 22425)
++++ krb5/src/appl/gssftp/ftp/ftp_var.h (working copy)
+@@ -46,13 +46,19 @@
#define FDOPEN_SOCKET(s, mode) fdopen_socket(s, mode)
#define SOCKETNO(fd) _get_osfhandle(fd)
#define PERROR_SOCKET(str) do { errno = SOCKET_ERRNO; perror(str); } while(0)
@@ -99,12 +41,15 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
+#define FSEEK(fd, offset, whence) fseeko(fd, (off_t) offset, whence)
+#else
+#define FSEEK(fd, offset, whence) fseek(fd, (long) offset, whence)
-+#endif
#endif
++#endif
#ifdef _WIN32
---- krb5/src/appl/gssftp/ftp/ftp.c 2009-06-29 18:05:08.000000000 -0400
-+++ krb5/src/appl/gssftp/ftp/ftp.c 2009-06-29 18:05:04.000000000 -0400
+ typedef void (*sig_t)(int);
+Index: krb5/src/appl/gssftp/ftp/ftp.c
+===================================================================
+--- krb5/src/appl/gssftp/ftp/ftp.c (revision 22425)
++++ krb5/src/appl/gssftp/ftp/ftp.c (working copy)
@@ -150,7 +150,11 @@
static void proxtrans (char *, char *, char *);
@@ -117,7 +62,7 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
static void abort_remote (FILE *);
static void tvsub (struct timeval *, struct timeval *, struct timeval *);
static char *gunique (char *);
-@@ -780,7 +784,11 @@
+@@ -775,7 +779,11 @@
FILE *volatile fin, *volatile dout = 0;
int (*volatile closefunc)();
volatile sig_t oldintr, oldintp;
@@ -129,7 +74,7 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
char *volatile lmode;
unsigned char buf[FTP_BUFSIZ], *bufp;
-@@ -877,7 +885,7 @@
+@@ -872,7 +880,7 @@
if (restart_point &&
(strcmp(cmd, "STOR") == 0 || strcmp(cmd, "APPE") == 0)) {
@@ -138,7 +83,7 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
fprintf(stderr, "local: %s: %s\n", local,
strerror(errno));
restart_point = 0;
-@@ -1272,7 +1280,7 @@
+@@ -1266,7 +1274,7 @@
if (restart_point) {
register int i, n, ch;
@@ -147,7 +92,7 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
goto done;
n = restart_point;
for (i = 0; i++ < n;) {
-@@ -1281,7 +1289,7 @@
+@@ -1275,7 +1283,7 @@
if (ch == '\n')
i++;
}
@@ -156,7 +101,7 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
done:
fprintf(stderr, "local: %s: %s\n", local,
strerror(errno));
-@@ -1546,8 +1554,13 @@
+@@ -1538,8 +1546,13 @@
return (FDOPEN_SOCKET(data, lmode));
}
@@ -170,7 +115,7 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
{
struct timeval td;
float s, kbs;
-@@ -1570,8 +1570,13 @@
+@@ -1549,8 +1562,13 @@
s = td.tv_sec + (td.tv_usec / 1000000.);
#define nz(x) ((x) == 0 ? 1 : (x))
kbs = (bytes / nz(s))/1024.0;
@@ -184,9 +129,78 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
}
}
---- krb5/src/appl/gssftp/ftpd/ftpd.c 2009-06-29 18:07:16.000000000 -0400
-+++ krb5/src/appl/gssftp/ftpd/ftpd.c 2009-06-29 18:07:57.000000000 -0400
-@@ -1253,7 +1253,7 @@
+Index: krb5/src/appl/gssftp/ftpd/ftpcmd.y
+===================================================================
+--- krb5/src/appl/gssftp/ftpd/ftpcmd.y (revision 22425)
++++ krb5/src/appl/gssftp/ftpd/ftpcmd.y (working copy)
+@@ -1497,12 +1497,20 @@
+ (stbuf.st_mode&S_IFMT) != S_IFREG)
+ reply(550, "%s: not a plain file.", filename);
+ else
++#ifdef HAVE_LONG_LONG
++ reply(213, "%llu", (long long) stbuf.st_size);
++#else
+ reply(213, "%lu", (long) stbuf.st_size);
++#endif
+ break;}
+ case TYPE_A: {
+ FILE *fin;
+ register int c;
++#ifdef HAVE_LONG_LONG
++ register long long count;
++#else
+ register long count;
++#endif
+ struct stat stbuf;
+ fin = fopen(filename, "r");
+ if (fin == NULL) {
+@@ -1524,7 +1532,11 @@
+ }
+ (void) fclose(fin);
+
++#ifdef HAVE_LONG_LONG
++ reply(213, "%lld", count);
++#else
+ reply(213, "%ld", count);
++#endif
+ break;}
+ default:
+ reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
+Index: krb5/src/appl/gssftp/ftpd/ftpd_var.h
+===================================================================
+--- krb5/src/appl/gssftp/ftpd/ftpd_var.h (revision 22425)
++++ krb5/src/appl/gssftp/ftpd/ftpd_var.h (working copy)
+@@ -41,6 +41,12 @@
+ char *radix_error (int);
+ int radix_encode (unsigned char *, unsigned char *, int *, int);
+
++#ifdef HAVE_FSEEKO
++#define FSEEK(fd, offset, whence) fseeko(fd, (off_t) offset, whence)
++#else
++#define FSEEK(fd, offset, whence) fseek(fd, (long) offset, whence)
++#endif
++
+ /* ftpd.c */
+ void ack(char *);
+ int auth_data(char *);
+Index: krb5/src/appl/gssftp/ftpd/ftpd.c
+===================================================================
+--- krb5/src/appl/gssftp/ftpd/ftpd.c (revision 22425)
++++ krb5/src/appl/gssftp/ftpd/ftpd.c (working copy)
+@@ -1146,7 +1146,11 @@
+ done:
+ (*closefunc)(fin);
+ if (logging > 2 && !cmd)
+- syslog(LOG_NOTICE, "get: %i bytes transferred", byte_count);
++#ifdef HAVE_LONG_LONG
++ syslog(LOG_NOTICE, "get: %lld bytes transferred", (long long) byte_count);
++#else
++ syslog(LOG_NOTICE, "get: %ld bytes transferred", (long) byte_count);
++#endif
+ }
+
+ void
+@@ -1191,7 +1195,7 @@
* because we are changing from reading to
* writing.
*/
@@ -195,7 +209,20 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
perror_reply(550, name);
goto done;
}
-@@ -1340,8 +1340,13 @@
+@@ -1216,7 +1220,11 @@
+ done:
+ (*closefunc)(fout);
+ if (logging > 2)
+- syslog(LOG_NOTICE, "put: %i bytes transferred", byte_count);
++#ifdef HAVE_LONG_LONG
++ syslog(LOG_NOTICE, "get: %lld bytes transferred", byte_count);
++#else
++ syslog(LOG_NOTICE, "get: %ld bytes transferred", (long) byte_count);
++#endif
+ }
+
+ FILE *
+@@ -1278,8 +1286,13 @@
byte_count = 0;
if (size != (off_t) -1)
/* cast size to long in case sizeof(off_t) > sizeof(long) */
@@ -209,12 +236,12 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
else
sizebuf[0] = '\0';
if (pdata >= 0) {
-@@ -2057,6 +2062,15 @@
+@@ -1991,13 +2004,23 @@
siglongjmp(urgcatch, 1);
}
if (strcmp(cp, "STAT") == 0) {
+#ifdef HAVE_LONG_LONG
-+ if (file_size != (off_t) -1)
+ if (file_size != (off_t) -1)
+ reply(213, "Status: %llu of %llu bytes transferred",
+ (unsigned long long) byte_count,
+ (unsigned long long) file_size);
@@ -222,10 +249,10 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
+ reply(213, "Status: %llu bytes transferred",
+ (unsigned long long) byte_count);
+#else
- if (file_size != (off_t) -1)
++ if (file_size != (off_t) -1)
reply(213, "Status: %lu of %lu bytes transferred",
(unsigned long) byte_count,
-@@ -2064,6 +2078,7 @@
+ (unsigned long) file_size);
else
reply(213, "Status: %lu bytes transferred",
(unsigned long) byte_count);
@@ -233,18 +260,35 @@ diff -up krb5/src/appl/gssftp/ftp/ftp_var.h krb5/src/appl/gssftp/ftp/ftp_var.h
}
}
---- krb5/src/appl/gssftp/ftpd/ftpd_var.h 2009-06-29 18:19:02.000000000 -0400
-+++ krb5/src/appl/gssftp/ftpd/ftpd_var.h 2009-06-29 18:19:44.000000000 -0400
-@@ -41,6 +41,12 @@
- char *radix_error (int);
- int radix_encode (unsigned char *, unsigned char *, int *, int);
-
-+#ifdef HAVE_FSEEKO
-+#define FSEEK(fd, offset, whence) fseeko(fd, (off_t) offset, whence)
+Index: krb5/src/appl/bsd/configure.in
+===================================================================
+--- krb5/src/appl/bsd/configure.in (revision 22425)
++++ krb5/src/appl/bsd/configure.in (working copy)
+@@ -51,6 +51,9 @@
+ AC_TYPE_MODE_T
+ AC_CHECK_FUNCS(isatty inet_aton getenv gettosbyname killpg initgroups setpriority setreuid setresuid waitpid setsid ptsname setlogin tcgetpgrp tcsetpgrp setpgid strsave utimes rmufile rresvport_af)
+ AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h utmp.h sys/time.h sys/ioctl_compat.h paths.h arpa/nameser.h)
++AC_SYS_LARGEFILE
++AC_FUNC_FSEEKO
++AC_CHECK_TYPES([long long])
+ AC_HEADER_STDARG
+ AC_REPLACE_FUNCS(getdtablesize)
+ dnl
+Index: krb5/src/appl/bsd/krcp.c
+===================================================================
+--- krb5/src/appl/bsd/krcp.c (revision 22425)
++++ krb5/src/appl/bsd/krcp.c (working copy)
+@@ -764,8 +764,13 @@
+ continue;
+ }
+ }
++#ifdef HAVE_LONG_LONG
++ (void) snprintf(buf, sizeof(buf), "C%04o %lld %s\n",
++ (int) stb.st_mode&07777, (long long) stb.st_size, last);
+#else
-+#define FSEEK(fd, offset, whence) fseek(fd, (long) offset, whence)
+ (void) snprintf(buf, sizeof(buf), "C%04o %ld %s\n",
+ (int) stb.st_mode&07777, (long ) stb.st_size, last);
+#endif
-+
- /* ftpd.c */
- void ack(char *);
- int auth_data(char *);
+ (void) rcmd_stream_write(rem, buf, strlen(buf), 0);
+ if (response() < 0) {
+ (void) close(f);