LINUX.ORG.RU
ФорумAdmin

ftpd и cp1251


0

0

Подскажите, какой ftp-server умеет отдавать директории и имена файлов в cp1251 кодировке? Именно с перекодировкой, т.к. на самом сервере локаль в koi8-r

Re: ftpd и cp1251

http://home.h01.itscom.net/para/software/misc/proftpd-iconv/index-e.html

и патч, решающий проблемы с буквой "я":

---proftpd-1.2.10-rus_ya.diff---
diff -urN proftpd-1.2.10.orig/src/netio.c proftpd-1.2.10/src/netio.c
--- proftpd-1.2.10.orig/src/netio.c     2004-06-15 20:45:21.000000000 +0400
+++ proftpd-1.2.10/src/netio.c  2005-03-10 22:01:17.000000000 +0300
@@ -802,108 +802,63 @@
   return buf;
 }
 
-char *pr_netio_telnet_gets(char *buf, size_t buflen,
-    pr_netio_stream_t *in_nstrm, pr_netio_stream_t *out_nstrm) {
+char *pr_netio_telnet_gets(char *buf, size_t buflen, 
+       pr_netio_stream_t *in_nstrm, pr_netio_stream_t *out_nstrm) {
+               char *bp = buf;
+               unsigned char cp;
+               static unsigned char mode = 0;
+               int toread;
+               pr_buffer_t *pbuf = NULL;
+               buflen--;
+
+               if (in_nstrm->strm_buf)
+                       pbuf = in_nstrm->strm_buf;
+               else
+                       pbuf = netio_buffer_alloc(in_nstrm);
+
+               while (buflen) {
+
+                       /* Is the buffer empty? */
+                       if (!pbuf->current ||
+                               pbuf->remaining == pbuf->buflen) {
+
+                                       toread = pr_netio_read(in_nstrm, pbuf->buf, 
+                                               (buflen < pbuf->buflen ?  buflen : pbuf->buflen), 1);
+
+                                       if (toread <= 0) {
+                                               if (bp != buf) {
+                                                       *bp = '\0';
+                                                       return buf;
+                                               } else
+                                                       return NULL;
+                                       }
+
+                                       pbuf->remaining = pbuf->buflen - toread;
+                                       pbuf->current = pbuf->buf;
+
+                       } else
+                               toread = pbuf->buflen - pbuf->remaining;
+                       while (buflen && toread > 0 && *pbuf->current != '\n' && toread--) {
+                               cp = *pbuf->current++;
+                               pbuf->remaining++;
+                               *bp++ = cp;
+                               buflen--;
+                       }
+
+                       if (buflen && toread && *pbuf->current == '\n') {
+                               buflen--;
+                               toread--;
+                               *bp++ = *pbuf->current++;
+                               pbuf->remaining++; 
+                               break;
+                       }
+
+                       if (!toread)
+                               pbuf->current = NULL;
+               }
 
-  char *bp = buf;
-  unsigned char cp;
-  static unsigned char mode = 0;
-  int toread;
-  pr_buffer_t *pbuf = NULL;
-  buflen--;
-
-  if (in_nstrm->strm_buf)
-    pbuf = in_nstrm->strm_buf;
-  else
-    pbuf = netio_buffer_alloc(in_nstrm);
-
-  while (buflen) {
-
-    /* Is the buffer empty? */
-    if (!pbuf->current ||
-        pbuf->remaining == pbuf->buflen) {
-
-      toread = pr_netio_read(in_nstrm, pbuf->buf,
-        (buflen < pbuf->buflen ?  buflen : pbuf->buflen), 1);
-
-      if (toread <= 0) {
-        if (bp != buf) {
-          *bp = '\0';
-          return buf;
-
-        } else
-          return NULL;
-      }
-
-      pbuf->remaining = pbuf->buflen - toread;
-      pbuf->current = pbuf->buf;
-
-    } else
-      toread = pbuf->buflen - pbuf->remaining;
-
-    while (buflen && toread > 0 && *pbuf->current != '\n' && toread--) {
-      cp = *pbuf->current++;
-      pbuf->remaining++;
-
-      switch (mode) {
-        case IAC:
-          switch (cp) {
-            case WILL:
-            case WONT:
-            case DO:
-            case DONT:
-              mode = cp;
-              continue;
-
-            case IAC:
-              mode = 0;
-              break;
-
-            default:
-              /* Ignore */
-              mode = 0;
-              continue;
-          }
-          break;
-
-        case WILL:
-        case WONT:
-          pr_netio_printf(out_nstrm, "%c%c%c", IAC, DONT, cp);
-          mode = 0;
-          continue;
-
-        case DO:
-        case DONT:
-          pr_netio_printf(out_nstrm, "%c%c%c", IAC, WONT, cp);
-          mode = 0;
-          continue;
-
-        default:
-          if (cp == IAC) {
-            mode = cp;
-            continue;
-          }
-          break;
-      }
-
-      *bp++ = cp;
-      buflen--;
-    }
-
-    if (buflen && toread && *pbuf->current == '\n') {
-      buflen--;
-      toread--;
-      *bp++ = *pbuf->current++;
-      pbuf->remaining++;
-      break;
-    }
-
-    if (!toread)
-      pbuf->current = NULL;
-  }
-
-  *bp = '\0';
-  return buf;
+               *bp = '\0';
+               return buf;
 }
 
 int pr_register_netio(pr_netio_t *netio, int strm_types) {

Deleted ()
Ответ на: Re: ftpd и cp1251 от Deleted

Re: ftpd и cp1251

Да... и ещё:
--- configure.in~       2004-05-26 06:15:35.000000000 +0400
+++ configure.in        2005-05-20 21:38:06.000000000 +0400
@@ -21,8 +21,8 @@

AC_INIT(include/conf.h)

-ac_core_modules="mod_core.o mod_xfer.o mod_auth_unix.o mod_auth_file.o mod_auth.o mod_ls.o mod_log.o mod_site.o"
-ac_build_core_modules="modules/mod_core.o modules/mod_xfer.o modules/mod_auth_unix.o modules/mod_auth_file.o modules/mod_auth.o modules/mod_ls.o modules/mod_log.o modules/mod_site.o"
+ac_core_modules="mod_core.o mod_xfer.o mod_auth_unix.o mod_auth_file.o mod_auth.o mod_ls.o mod_log.o mod_site.o mod_codeconv.o"
+ac_build_core_modules="modules/mod_core.o modules/mod_xfer.o modules/mod_auth_unix.o modules/mod_auth_file.o modules/mod_auth.o modules/mod_ls.o modules/mod_log.o modules/mod_site.o modules/mod_codeconv.o"

Deleted ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.