View | Details | Raw Unified | Return to bug 1632 | Differences between
and this patch

Collapse All | Expand All

(-)a/sftp-server.8 (-1 / +10 lines)
Lines 30-39 Link Here
30
.Nd SFTP server subsystem
30
.Nd SFTP server subsystem
31
.Sh SYNOPSIS
31
.Sh SYNOPSIS
32
.Nm sftp-server
32
.Nm sftp-server
33
.Op Fl eh
33
.Op Fl ehS
34
.Op Fl f Ar log_facility
34
.Op Fl f Ar log_facility
35
.Op Fl l Ar log_level
35
.Op Fl l Ar log_level
36
.Op Fl u Ar umask
36
.Op Fl u Ar umask
37
.Op Fl s Ar filename_charset
37
.Sh DESCRIPTION
38
.Sh DESCRIPTION
38
.Nm
39
.Nm
39
is a program that speaks the server side of SFTP protocol
40
is a program that speaks the server side of SFTP protocol
Lines 86-91 Sets an explicit Link Here
86
.Xr umask 2
87
.Xr umask 2
87
to be applied to newly-created files and directories, instead of the
88
to be applied to newly-created files and directories, instead of the
88
user's default mask.
89
user's default mask.
90
.It Fl s Ar filename_charset
91
Specifies the charset that is being used to encode filenames on the
92
server file system. The client software can use this information to
93
convert between the server and local charsets. By default
94
.Nm
95
tries to autodetect the charset from the locale configuration.
96
.It Fl S
97
Disables the filename charset extension.
89
.El
98
.El
90
.Pp
99
.Pp
91
For logging to work,
100
For logging to work,
(-)a/sftp-server.c (-2 / +28 lines)
Lines 32-37 Link Here
32
#include <time.h>
32
#include <time.h>
33
#include <unistd.h>
33
#include <unistd.h>
34
#include <stdarg.h>
34
#include <stdarg.h>
35
#include <locale.h>
36
#include <nl_types.h>
37
#include <langinfo.h>
35
38
36
#include "xmalloc.h"
39
#include "xmalloc.h"
37
#include "buffer.h"
40
#include "buffer.h"
Lines 61-66 Buffer oqueue; Link Here
61
/* Version of client */
64
/* Version of client */
62
int version;
65
int version;
63
66
67
/* Charset used to encode names on the file system */
68
char *filename_charset = NULL;
69
int disable_filename_charset_ext = 0;
70
64
/* portable attributes, etc. */
71
/* portable attributes, etc. */
65
72
66
typedef struct Stat Stat;
73
typedef struct Stat Stat;
Lines 523-528 process_init(void) Link Here
523
	/* fstatvfs extension */
530
	/* fstatvfs extension */
524
	buffer_put_cstring(&msg, "fstatvfs@openssh.com");
531
	buffer_put_cstring(&msg, "fstatvfs@openssh.com");
525
	buffer_put_cstring(&msg, "2"); /* version */
532
	buffer_put_cstring(&msg, "2"); /* version */
533
	/* filename charset extension */ 
534
	if (!disable_filename_charset_ext) {
535
		if (!filename_charset) {
536
			setlocale(LC_CTYPE, "");
537
			filename_charset = nl_langinfo(CODESET);
538
			setlocale(LC_CTYPE, "C");
539
			if ((strcmp(filename_charset, "646") == 0) ||
540
			    (strcmp(filename_charset, "ANSI_X3.4-1968") == 0))
541
				filename_charset = "ISO-8859-1";
542
		}
543
		buffer_put_cstring(&msg, "filename-charset@openssh.com");
544
		buffer_put_cstring(&msg, filename_charset);
545
	}
526
	send_msg(&msg);
546
	send_msg(&msg);
527
	buffer_free(&msg);
547
	buffer_free(&msg);
528
}
548
}
Lines 1314-1321 sftp_server_main(int argc, char **argv, struct passwd *user_pw) Link Here
1314
	extern char *__progname;
1334
	extern char *__progname;
1315
1335
1316
	log_init(__progname, log_level, log_facility, log_stderr);
1336
	log_init(__progname, log_level, log_facility, log_stderr);
1317
1337
	
1318
	while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che")) != -1) {
1338
	while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che:S")) != -1) {
1319
		switch (ch) {
1339
		switch (ch) {
1320
		case 'c':
1340
		case 'c':
1321
			/*
1341
			/*
Lines 1344-1349 sftp_server_main(int argc, char **argv, struct passwd *user_pw) Link Here
1344
				    optarg, errmsg);
1364
				    optarg, errmsg);
1345
			(void)umask(mask);
1365
			(void)umask(mask);
1346
			break;
1366
			break;
1367
		case 's':
1368
		        filename_charset = xstrdup(optarg);
1369
			break;
1370
		case 'S':
1371
			disable_filename_charset_ext = 1;
1372
			break;
1347
		case 'h':
1373
		case 'h':
1348
		default:
1374
		default:
1349
			sftp_server_usage();
1375
			sftp_server_usage();

Return to bug 1632