[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] CVS: proftpd/src fsio.c,1.50,1.51 main.c,1.282,1.283 netio.c,1.21,1.22
From:       TJ Saunders <castaglia () users ! sourceforge ! net>
Date:       2006-05-26 17:16:42
Message-ID: E1FjfvW-0005y5-9k () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22516/src

Modified Files:
	fsio.c main.c netio.c 
Log Message:

Marking more places in the source for gettext manipulation.  Added two
new functions, pr_fs_decode_path() and pr_fs_encode_path(), which are
to be used for encoding to/from UTF8 paths (or not).


Index: fsio.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/fsio.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- fsio.c	22 Mar 2006 22:10:34 -0000	1.50
+++ fsio.c	26 May 2006 17:16:40 -0000	1.51
@@ -1846,6 +1846,44 @@
   sstrncpy(buf, workpath, buflen);
 }
 
+char *pr_fs_decode_path(pool *p, const char *path) {
+#ifdef PR_USE_NLS
+  size_t outlen;
+  char *res;
+
+  res = pr_utf8_decode(p, path, strlen(path) + 1, &outlen);
+  if (!res) {
+    pr_trace_msg("utf8", 0, "error UTF8 decoding path '%s': %s", path,
+      strerror(errno));
+    return (char *) path;
+  }
+
+  pr_trace_msg("utf8", 5, "UTF8-decoded '%s' into '%s'", path, res);
+  return res;
+#else
+  return (char *) path;
+#endif /* PR_USE_NLS */
+}
+
+char *pr_fs_encode_path(pool *p, const char *path) {
+#ifdef PR_USE_NLS
+  size_t outlen;
+  char *res;
+
+  res = pr_utf8_encode(p, path, strlen(path) + 1, &outlen);
+  if (!res) {
+    pr_trace_msg("utf8", 0, "error UTF8 encoding path '%s': %s", path,
+      strerror(errno));
+    return (char *) path;
+  }
+
+  pr_trace_msg("utf8", 5, "UTF8-encoded '%s' into '%s'", path, res);
+  return res;
+#else
+  return (char *) path;
+#endif /* PR_USE_NLS */
+}
+
 /* This function checks the given path's prefix against the paths that
  * have been registered.  If no matching path prefix has been registered,
  * the path is considered invalid.

Index: main.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/main.c,v
retrieving revision 1.282
retrieving revision 1.283
diff -u -r1.282 -r1.283
--- main.c	25 May 2006 16:55:34 -0000	1.282
+++ main.c	26 May 2006 17:16:40 -0000	1.283
@@ -489,7 +489,6 @@
                    NULL );
 
     pr_response_send_async(R_421, _("FTP server shutting down - %s"), msg);
-
     session_exit(PR_LOG_NOTICE, msg, 0, NULL);
   }
 
@@ -754,8 +753,8 @@
 
   pr_event_generate("core.timeout-idle", NULL);
 
-  pr_response_send_async(R_421, _("Idle Timeout (%d seconds): closing control "
-    "connection"), TimeoutIdle);
+  pr_response_send_async(R_421,
+    _("Idle timeout (%d seconds): closing control connection"), TimeoutIdle);
   session_exit(PR_LOG_INFO, "FTP session idle timeout, disconnected", 0, NULL);
 
   pr_timer_remove(TIMER_LOGIN, ANY_MODULE);
@@ -817,7 +816,7 @@
         " Server (%s) [%s]", server->ServerName, serveraddress);
 
   } else
-    pr_response_send(R_220, "%s FTP server ready", serveraddress);
+    pr_response_send(R_220, _("%s FTP server ready"), serveraddress);
 
   pr_log_pri(PR_LOG_INFO, "FTP session opened.");
 
@@ -1325,8 +1324,8 @@
                reason, session.c->remote_name,
                pr_netaddr_get_ipstr(session.c->remote_addr));
 
-      pr_response_send(R_500, _("FTP server shut down (%s) -- please try again "
-        "later"), reason);
+      pr_response_send(R_500,
+        _("FTP server shut down (%s) -- please try again later"), reason);
       exit(0);
     }
   }
@@ -1335,8 +1334,14 @@
    * connected to, drop them.
    */
   if (!main_server) {
-    pr_response_send(R_500, _("Sorry, no server available to handle request on "
-      "%s"), pr_netaddr_get_dnsstr(conn->local_addr));
+    pr_log_debug(DEBUG2, "No server configuration found for IP address %s",
+      pr_netaddr_get_ipstr(conn->local_addr));
+    pr_log_debug(DEBUG2, "Use the DefaultServer directive to designate "
+      "a default server configuration to handle requests like this");
+
+    pr_response_send(R_500,
+      _("Sorry, no server available to handle request on %s"),
+      pr_netaddr_get_dnsstr(conn->local_addr));
     exit(0);
   }
 
@@ -1381,8 +1386,9 @@
     end_login(1);
 
   /* Use the ident protocol (RFC1413) to try to get remote ident_user */
-  if ((ident_lookups = get_param_ptr(main_server->conf, "IdentLookups",
-     FALSE)) == NULL || *ident_lookups == TRUE) {
+  ident_lookups = get_param_ptr(main_server->conf, "IdentLookups", FALSE);
+  if (ident_lookups == NULL ||
+      *ident_lookups == TRUE) {
     pr_log_debug(DEBUG6, "performing ident lookup");
     session.ident_lookups = TRUE;
     session.ident_user = pr_ident_lookup(session.pool, conn);

Index: netio.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/src/netio.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- netio.c	9 Oct 2004 20:46:22 -0000	1.21
+++ netio.c	26 May 2006 17:16:40 -0000	1.22
@@ -1,6 +1,6 @@
 /*
  * ProFTPD - FTP server daemon
- * Copyright (c) 2001, 2002, 2003 The ProFTPD Project team
+ * Copyright (c) 2001-2006 The ProFTPD Project team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -341,7 +341,7 @@
   }
 
   /* Send an appropriate response code down the stream asychronously. */
-  pr_response_send_async(R_426, "Transfer aborted. Data connection closed.");
+  pr_response_send_async(R_426, _("Transfer aborted. Data connection closed."));
 
   /* Now continue with a normal lingering close. */
   return netio_lingering_close(nstrm, linger,



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic