Bugzilla – Attachment 1773 Details for
Bug 1632
[PATCH] UTF-8 hint sftp-server extension
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
filename-charset@openssh.com with autodetection extension, enabled by default
sftp-filename-charset-ext-2.patch (text/plain), 2.79 KB, created by
Salvador Fandiño
on 2010-01-11 04:48:47 AEDT
(
hide
)
Description:
filename-charset@openssh.com with autodetection extension, enabled by default
Filename:
MIME Type:
Creator:
Salvador Fandiño
Created:
2010-01-11 04:48:47 AEDT
Size:
2.79 KB
patch
obsolete
>diff --git a/sftp-server.8 b/sftp-server.8 >index 27b67ed..f8d1ff1 100644 >--- a/sftp-server.8 >+++ b/sftp-server.8 >@@ -30,10 +30,11 @@ > .Nd SFTP server subsystem > .Sh SYNOPSIS > .Nm sftp-server >-.Op Fl eh >+.Op Fl ehS > .Op Fl f Ar log_facility > .Op Fl l Ar log_level > .Op Fl u Ar umask >+.Op Fl s Ar filename_charset > .Sh DESCRIPTION > .Nm > is a program that speaks the server side of SFTP protocol >@@ -86,6 +87,14 @@ Sets an explicit > .Xr umask 2 > to be applied to newly-created files and directories, instead of the > user's default mask. >+.It Fl s Ar filename_charset >+Specifies the charset that is being used to encode filenames on the >+server file system. The client software can use this information to >+convert between the server and local charsets. By default >+.Nm >+tries to autodetect the charset from the locale configuration. >+.It Fl S >+Disables the filename charset extension. > .El > .Pp > For logging to work, >diff --git a/sftp-server.c b/sftp-server.c >index 27e80f0..27984df 100644 >--- a/sftp-server.c >+++ b/sftp-server.c >@@ -32,6 +32,9 @@ > #include <time.h> > #include <unistd.h> > #include <stdarg.h> >+#include <locale.h> >+#include <nl_types.h> >+#include <langinfo.h> > > #include "xmalloc.h" > #include "buffer.h" >@@ -61,6 +64,10 @@ Buffer oqueue; > /* Version of client */ > int version; > >+/* Charset used to encode names on the file system */ >+char *filename_charset = NULL; >+int disable_filename_charset_ext = 0; >+ > /* portable attributes, etc. */ > > typedef struct Stat Stat; >@@ -523,6 +530,19 @@ process_init(void) > /* fstatvfs extension */ > buffer_put_cstring(&msg, "fstatvfs@openssh.com"); > buffer_put_cstring(&msg, "2"); /* version */ >+ /* filename charset extension */ >+ if (!disable_filename_charset_ext) { >+ if (!filename_charset) { >+ setlocale(LC_CTYPE, ""); >+ filename_charset = nl_langinfo(CODESET); >+ setlocale(LC_CTYPE, "C"); >+ if ((strcmp(filename_charset, "646") == 0) || >+ (strcmp(filename_charset, "ANSI_X3.4-1968") == 0)) >+ filename_charset = "ISO-8859-1"; >+ } >+ buffer_put_cstring(&msg, "filename-charset@openssh.com"); >+ buffer_put_cstring(&msg, filename_charset); >+ } > send_msg(&msg); > buffer_free(&msg); > } >@@ -1314,8 +1334,8 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) > extern char *__progname; > > log_init(__progname, log_level, log_facility, log_stderr); >- >- while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che")) != -1) { >+ >+ while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che:S")) != -1) { > switch (ch) { > case 'c': > /* >@@ -1344,6 +1364,12 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw) > optarg, errmsg); > (void)umask(mask); > break; >+ case 's': >+ filename_charset = xstrdup(optarg); >+ break; >+ case 'S': >+ disable_filename_charset_ext = 1; >+ break; > case 'h': > default: > sftp_server_usage();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1632
:
1668
|
1769
|
1770
| 1773