Bugzilla – Attachment 1770 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]
...and guess encoding from environment
openssh-filename-charset-1.patch (text/plain), 1.84 KB, created by
Salvador Fandiño
on 2010-01-09 01:40:01 AEDT
(
hide
)
Description:
...and guess encoding from environment
Filename:
MIME Type:
Creator:
Salvador Fandiño
Created:
2010-01-09 01:40:01 AEDT
Size:
1.84 KB
patch
obsolete
>diff --git a/sftp-server.c b/sftp-server.c >index 27e80f0..fe1c84f 100644 >--- a/sftp-server.c >+++ b/sftp-server.c >@@ -32,7 +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" > #include "log.h" >@@ -61,6 +63,9 @@ Buffer oqueue; > /* Version of client */ > int version; > >+/* Charset used to encode names on the file system */ >+char *filename_charset = NULL; >+ > /* portable attributes, etc. */ > > typedef struct Stat Stat; >@@ -523,6 +528,11 @@ process_init(void) > /* fstatvfs extension */ > buffer_put_cstring(&msg, "fstatvfs@openssh.com"); > buffer_put_cstring(&msg, "2"); /* version */ >+ /* filename charset extension */ >+ if (filename_charset) { >+ buffer_put_cstring(&msg, "filename-charset@openssh.com"); >+ buffer_put_cstring(&msg, filename_charset); >+ } > send_msg(&msg); > buffer_free(&msg); > } >@@ -1314,8 +1324,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:ches:S")) != -1) { > switch (ch) { > case 'c': > /* >@@ -1344,6 +1354,18 @@ 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': >+ 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"; >+ filename_charset = xstrdup(filename_charset); >+ 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